#include <stdio.h>
#include <stdint.h>
#include <imp/imp_log.h>
#include "ncu_func.h"
#include "ncu_param.h"
#include "ncu_reg.h"
#ifdef DMALLOC
#include <imp/dmalloc.h>
#endif
#define TAG "NCUFUNC"

int (*lock)();
int (*unlock)();
int (*write_reg)(uint32_t off, uint32_t reg);
uint32_t (*read_reg)(uint32_t off);
void *(*get_params)(void);

static ncu_param *ncuparam = NULL;

int ncu_image_size_width = 1920;
int ncu_image_size_height= 1080;

int ncu_func_config(int width,int height)
{
	ncu_image_size_width  = width;
	ncu_image_size_height = height;

	return 0;
}

int ncu_func_init(ncu_func_init_param *initp)
{
	lock = initp->lock;
	unlock = initp->unlock;
	write_reg = initp->write_reg;
	read_reg = initp->read_reg;
	get_params = initp->get_params;
	ncuparam = (ncu_param*)get_params();
	IMP_LOG_INFO(TAG,"--------------\n");
	/* TO DO */

	return 0;
}

int ncu_func_bypass(int en)
{
	lock();
	write_reg(NCU_FUN_CNTRL, 0x5f5f);
	read_reg(NCU_FUN_CNTRL);
	unlock();

	return 0;
}

int ncu_func_par_download(uint32_t gain);
int32_t ncu_func_linear_insert(int32_t D0, int32_t D1, int32_t D2,
			       int32_t D3, int32_t D4, int32_t D5,
			       int32_t D6, int32_t D7, int32_t D8,
			       int32_t G0, int32_t G1, int32_t G2,
			       int32_t G3, int32_t G4, int32_t G5,
			       int32_t G6, int32_t G7, int32_t G8,
			       int32_t GAIN);

int32_t ncu_func_non_linear_insert(int32_t D0, int32_t D1, int32_t D2,
				   int32_t D3, int32_t D4, int32_t D5,
				   int32_t D6, int32_t D7, int32_t D8,
				   int32_t G0, int32_t G1, int32_t G2,
				   int32_t G3, int32_t G4, int32_t G5,
				   int32_t G6, int32_t G7, int32_t G8,
				   int32_t GAIN);

int ncu_func_update(uint32_t gain)
{

	lock();
	//IMP_LOG_DBG(TAG,"info : gain = %d(0x%x)\n", gain, gain);
	ncu_func_par_download(gain);
	unlock();

	return 0;
}

/* default 100% */
int ncu_func_strength(int strength)
{
	return 0;
}

int ncu_func_par_download(uint32_t gain)
{
	//========================================================
	// MAIN FUNCTION CONTROL REGISTER MAP
	//--------------------------------------------------------
	//27     : ncu_uv_psn_sta_use  -> 0: use sta 1: use psn
	//26     : ncu_y_psn_sta_use   -> 0: use sta 1: use psn
	//25     : ncu_uv_sta_src_sel  -> 0: owner 1: use y sta info
	//24     : ncu_uv_psn_src_sel  -> 0: owner 1: use y psn info
	//--------------------------------------------------------
	//23     : ncu_uv_sta_out_en   -> UV STA output enable
	//22     : ncu_uv_psn_out_en   -> UV PSN output enable
	//21     : ncu_uv_sta_in_en    -> UV STA input enable
	//20     : ncu_uv_psn_in_en    -> UV PSN input enable
	//--------------------------------------------------------
	//19     : ncu_y_sta_out_en    -> Y STA output enable
	//18     : ncu_y_psn_out_en    -> Y PSN output enable
	//17     : ncu_y_sta_in_en     -> Y STA input enable
	//16     : ncu_y_psn_in_en     -> Y PSN input enable
	//--------------------------------------------------------
	//15     : ncu_uv_stage2_v_en  -> UV stage2 V channel enable
	//14     : ncu_uv_stage2_u_en  -> UV stage2 U channel enable
	//13     : ncu_uv_psn_start_md -> UV psn start mode
	//12     : ncu_y_psn_start_md  -> Y psn start mode
	//--------------------------------------------------------
	//11     : ncu_uv_stage2_en    -> UV stage2(BI-LINEAR) filter enable
	//10     : ncu_uv_stage1_en    -> UV stage1(FS&SE) filter enable
	// 9     : ncu_y_stage2_en     -> Y stage2(BI-LINEAR) filter enable
	// 8     : ncu_y_stage1_en     -> Y stage1(FS&SE) filter enable
	//--------------------------------------------------------
	// 7     : ncu_uv_out_swap     -> output UV channel swap
	// 6     : ncu_uv_in_swap      -> input UV channel swap
	// 5     : ncu_output_moe      -> 0: video output  1: dma output
	// 4     : ncu_input_mode      -> 0: video input   1: dma input
	//--------------------------------------------------------
	// 3     : ncu_frm_done_md     -> 0: check respond channel 1:no check
	// 2     : ncu_uv_chnl_disable -> write 1 to disbale UV channel
	// 1     : ncu_y_chnl_disable  -> write 1 to disable Y channel
	// 0     : ncu_disable         -> write 1 to disable ncu
	//========================================================

	int32_t  width  = ncu_image_size_width ;
	int32_t  height = ncu_image_size_height;

	int32_t CTRL_FLAGS = ncuparam->NCU_CTRL_FLAGS ;
	int32_t TOP_FUNC   = ncuparam->NCU_FUNCS      ;
	int32_t LUM_SDN_EN = ncuparam->NCU_L_SDN_EN   ;
	int32_t CRM_SDN_EN = ncuparam->NCU_C_SDN_EN   ;

	int32_t tmp0,tmp1;
	tmp0= ((TOP_FUNC  <<8 ) & 0xffffff00) |
		((read_reg(0x24)) & 0x000000ff) ;

	tmp1= ((tmp0 & 0xffff35ff)                ) |
		((CRM_SDN_EN << 11  ) & 0x00000800  ) |
		((CRM_SDN_EN << 14  ) & 0x00004000  ) |
		((CRM_SDN_EN << 15  ) & 0x00008000  ) |
		((LUM_SDN_EN << 9   ) & 0x00000200  ) ;

	int32_t dump_en    = (CTRL_FLAGS >> 4 ) & 0x1 ;
	int32_t print_gain = (CTRL_FLAGS >> 8 ) & 0x1 ;
	int32_t fst_flag   = (CTRL_FLAGS >> 12) & 0x1 ;

	write_reg(0xc,0x4);
	write_reg(0x24,tmp1);
	if (fst_flag == 1)
		write_reg(0x4,0x2);

	if (print_gain) {
		IMP_LOG_DBG(TAG,"@@@ INFO : gain = %d(0x%x)\n", gain, gain);
	}

	if (dump_en) {
		IMP_LOG_DBG(TAG,"@@@@NCU DRIVER :# CTRL_FLAGS = 0x%x\n",CTRL_FLAGS);
		IMP_LOG_DBG(TAG,"@@@@NCU DRIVER :# TOP_FUNCS  = 0x%x\n",tmp1      );
	}

	int32_t GAIN0 = ncuparam->NCU_GAIN_0;
	int32_t GAIN1 = ncuparam->NCU_GAIN_1;
	int32_t GAIN2 = ncuparam->NCU_GAIN_2;
	int32_t GAIN3 = ncuparam->NCU_GAIN_3;
	int32_t GAIN4 = ncuparam->NCU_GAIN_4;
	int32_t GAIN5 = ncuparam->NCU_GAIN_5;
	int32_t GAIN6 = ncuparam->NCU_GAIN_6;
	int32_t GAIN7 = ncuparam->NCU_GAIN_7;
	int32_t GAIN8 = ncuparam->NCU_GAIN_8;

	int32_t L_TDN_EN             = ncuparam->NCU_L_TDN_EN             ;
	int32_t L_LCK_EN             = ncuparam->NCU_L_LCK_EN             ;

	int32_t L_CNA_THRES          = ncuparam->NCU_L_CNA_THRES          ;
	int32_t L_CNA_STREN          = ncuparam->NCU_L_CNA_STREN          ;

	int32_t L_LID_THRES          = ncuparam->NCU_L_LID_THRES          ;
	int32_t L_LID_STREN          = ncuparam->NCU_L_LID_STREN          ;
	int32_t L_LIB_THRES          = ncuparam->NCU_L_LIB_THRES          ;
	int32_t L_LIB_STREN          = ncuparam->NCU_L_LIB_STREN          ;

	int32_t L_SMJ_THRES_0        = ncuparam->NCU_L_SMJ_THRES[0]       ;
	int32_t L_SMJ_THRES_1        = ncuparam->NCU_L_SMJ_THRES[1]       ;
	int32_t L_SMJ_THRES_2        = ncuparam->NCU_L_SMJ_THRES[2]       ;
	int32_t L_SMJ_THRES_3        = ncuparam->NCU_L_SMJ_THRES[3]       ;
	int32_t L_SMJ_THRES_4        = ncuparam->NCU_L_SMJ_THRES[4]       ;
	int32_t L_SMJ_THRES_5        = ncuparam->NCU_L_SMJ_THRES[5]       ;
	int32_t L_SMJ_THRES_6        = ncuparam->NCU_L_SMJ_THRES[6]       ;
	int32_t L_SMJ_THRES_7        = ncuparam->NCU_L_SMJ_THRES[7]       ;
	int32_t L_SMJ_THRES_8        = ncuparam->NCU_L_SMJ_THRES[8]       ;

	int32_t L_SMJ_THRES ;
	L_SMJ_THRES = ncu_func_linear_insert(L_SMJ_THRES_0,L_SMJ_THRES_1,L_SMJ_THRES_2,
					     L_SMJ_THRES_3,L_SMJ_THRES_4,L_SMJ_THRES_5,
					     L_SMJ_THRES_6,L_SMJ_THRES_7,L_SMJ_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_OSB_THRES          = ncuparam->NCU_L_OSB_THRES          ;
	int32_t L_OSB_SLOPE          = ncuparam->NCU_L_OSB_SLOPE          ;
	int32_t L_OSD_THRES          = ncuparam->NCU_L_OSD_THRES          ;
	int32_t L_OSD_SLOPE          = ncuparam->NCU_L_OSD_SLOPE          ;
	int32_t L_OMB_THRES          = ncuparam->NCU_L_OMB_THRES          ;
	int32_t L_OMB_SLOPE          = ncuparam->NCU_L_OMB_SLOPE          ;
	int32_t L_OMD_THRES          = ncuparam->NCU_L_OMD_THRES          ;
	int32_t L_OMD_SLOPE          = ncuparam->NCU_L_OMD_SLOPE          ;

	int32_t L_EDG_TYPE           = ncuparam->NCU_L_EDG_TYPE           ;
	int32_t L_EDG_DIFF_SLOPE_0   = ncuparam->NCU_L_EDG_DIFF_SLOPE[0]  ;
	int32_t L_EDG_DIFF_SLOPE_1   = ncuparam->NCU_L_EDG_DIFF_SLOPE[1]  ;
	int32_t L_EDG_DIFF_SLOPE_2   = ncuparam->NCU_L_EDG_DIFF_SLOPE[2]  ;
	int32_t L_EDG_DIFF_SLOPE_3   = ncuparam->NCU_L_EDG_DIFF_SLOPE[3]  ;
	int32_t L_EDG_DIFF_SLOPE_4   = ncuparam->NCU_L_EDG_DIFF_SLOPE[4]  ;
	int32_t L_EDG_DIFF_SLOPE_5   = ncuparam->NCU_L_EDG_DIFF_SLOPE[5]  ;
	int32_t L_EDG_DIFF_SLOPE_6   = ncuparam->NCU_L_EDG_DIFF_SLOPE[6]  ;
	int32_t L_EDG_DIFF_SLOPE_7   = ncuparam->NCU_L_EDG_DIFF_SLOPE[7]  ;
	int32_t L_EDG_DIFF_SLOPE_8   = ncuparam->NCU_L_EDG_DIFF_SLOPE[8]  ;

	int32_t L_EDG_DIFF_SLOPE ;
	L_EDG_DIFF_SLOPE = ncu_func_linear_insert(L_EDG_DIFF_SLOPE_0,L_EDG_DIFF_SLOPE_1,L_EDG_DIFF_SLOPE_2,
						  L_EDG_DIFF_SLOPE_3,L_EDG_DIFF_SLOPE_4,L_EDG_DIFF_SLOPE_5,
						  L_EDG_DIFF_SLOPE_6,L_EDG_DIFF_SLOPE_7,L_EDG_DIFF_SLOPE_8,
						  GAIN0        ,GAIN1        ,GAIN2        ,
						  GAIN3        ,GAIN4        ,GAIN5        ,
						  GAIN6        ,GAIN7        ,GAIN8        ,
						  gain);

	int32_t L_EDG_DIFF_LOW_0     = ncuparam->NCU_L_EDG_DIFF_LOW[0]    ;
	int32_t L_EDG_DIFF_LOW_1     = ncuparam->NCU_L_EDG_DIFF_LOW[1]    ;
	int32_t L_EDG_DIFF_LOW_2     = ncuparam->NCU_L_EDG_DIFF_LOW[2]    ;
	int32_t L_EDG_DIFF_LOW_3     = ncuparam->NCU_L_EDG_DIFF_LOW[3]    ;
	int32_t L_EDG_DIFF_LOW_4     = ncuparam->NCU_L_EDG_DIFF_LOW[4]    ;
	int32_t L_EDG_DIFF_LOW_5     = ncuparam->NCU_L_EDG_DIFF_LOW[5]    ;
	int32_t L_EDG_DIFF_LOW_6     = ncuparam->NCU_L_EDG_DIFF_LOW[6]    ;
	int32_t L_EDG_DIFF_LOW_7     = ncuparam->NCU_L_EDG_DIFF_LOW[7]    ;
	int32_t L_EDG_DIFF_LOW_8     = ncuparam->NCU_L_EDG_DIFF_LOW[8]    ;

	int32_t L_EDG_DIFF_LOW ;
	L_EDG_DIFF_LOW = ncu_func_linear_insert(L_EDG_DIFF_LOW_0,L_EDG_DIFF_LOW_1,L_EDG_DIFF_LOW_2,
						L_EDG_DIFF_LOW_3,L_EDG_DIFF_LOW_4,L_EDG_DIFF_LOW_5,
						L_EDG_DIFF_LOW_6,L_EDG_DIFF_LOW_7,L_EDG_DIFF_LOW_8,
						GAIN0        ,GAIN1        ,GAIN2        ,
						GAIN3        ,GAIN4        ,GAIN5        ,
						GAIN6        ,GAIN7        ,GAIN8        ,
						gain);

	int32_t L_EDG_DIFF_HIGH_0    = ncuparam->NCU_L_EDG_DIFF_HIGH[0]   ;
	int32_t L_EDG_DIFF_HIGH_1    = ncuparam->NCU_L_EDG_DIFF_HIGH[1]   ;
	int32_t L_EDG_DIFF_HIGH_2    = ncuparam->NCU_L_EDG_DIFF_HIGH[2]   ;
	int32_t L_EDG_DIFF_HIGH_3    = ncuparam->NCU_L_EDG_DIFF_HIGH[3]   ;
	int32_t L_EDG_DIFF_HIGH_4    = ncuparam->NCU_L_EDG_DIFF_HIGH[4]   ;
	int32_t L_EDG_DIFF_HIGH_5    = ncuparam->NCU_L_EDG_DIFF_HIGH[5]   ;
	int32_t L_EDG_DIFF_HIGH_6    = ncuparam->NCU_L_EDG_DIFF_HIGH[6]   ;
	int32_t L_EDG_DIFF_HIGH_7    = ncuparam->NCU_L_EDG_DIFF_HIGH[7]   ;
	int32_t L_EDG_DIFF_HIGH_8    = ncuparam->NCU_L_EDG_DIFF_HIGH[8]   ;

	int32_t L_EDG_DIFF_HIGH ;
	L_EDG_DIFF_HIGH = ncu_func_linear_insert(L_EDG_DIFF_HIGH_0,L_EDG_DIFF_HIGH_1,L_EDG_DIFF_HIGH_2,
						 L_EDG_DIFF_HIGH_3,L_EDG_DIFF_HIGH_4,L_EDG_DIFF_HIGH_5,
						 L_EDG_DIFF_HIGH_6,L_EDG_DIFF_HIGH_7,L_EDG_DIFF_HIGH_8,
						 GAIN0        ,GAIN1        ,GAIN2        ,
						 GAIN3        ,GAIN4        ,GAIN5        ,
						 GAIN6        ,GAIN7        ,GAIN8        ,
						 gain);

	int32_t L_ESA_PEAK           = ncuparam->NCU_L_ESA_PEAK           ;
	int32_t L_ESA_STREN_L        = ncuparam->NCU_L_ESA_STREN_L        ;

	int32_t L_ESA_THRES_0        = ncuparam->NCU_L_ESA_THRES[0]       ;
	int32_t L_ESA_THRES_1        = ncuparam->NCU_L_ESA_THRES[1]       ;
	int32_t L_ESA_THRES_2        = ncuparam->NCU_L_ESA_THRES[2]       ;
	int32_t L_ESA_THRES_3        = ncuparam->NCU_L_ESA_THRES[3]       ;
	int32_t L_ESA_THRES_4        = ncuparam->NCU_L_ESA_THRES[4]       ;
	int32_t L_ESA_THRES_5        = ncuparam->NCU_L_ESA_THRES[5]       ;
	int32_t L_ESA_THRES_6        = ncuparam->NCU_L_ESA_THRES[6]       ;
	int32_t L_ESA_THRES_7        = ncuparam->NCU_L_ESA_THRES[7]       ;
	int32_t L_ESA_THRES_8        = ncuparam->NCU_L_ESA_THRES[8]       ;

	int32_t L_ESA_THRES;
	L_ESA_THRES = ncu_func_linear_insert(L_ESA_THRES_0,L_ESA_THRES_1,L_ESA_THRES_2,
					     L_ESA_THRES_3,L_ESA_THRES_4,L_ESA_THRES_5,
					     L_ESA_THRES_6,L_ESA_THRES_7,L_ESA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_ESA_STREN_H_0      = ncuparam->NCU_L_ESA_STREN_H[0]     ;
	int32_t L_ESA_STREN_H_1      = ncuparam->NCU_L_ESA_STREN_H[1]     ;
	int32_t L_ESA_STREN_H_2      = ncuparam->NCU_L_ESA_STREN_H[2]     ;
	int32_t L_ESA_STREN_H_3      = ncuparam->NCU_L_ESA_STREN_H[3]     ;
	int32_t L_ESA_STREN_H_4      = ncuparam->NCU_L_ESA_STREN_H[4]     ;
	int32_t L_ESA_STREN_H_5      = ncuparam->NCU_L_ESA_STREN_H[5]     ;
	int32_t L_ESA_STREN_H_6      = ncuparam->NCU_L_ESA_STREN_H[6]     ;
	int32_t L_ESA_STREN_H_7      = ncuparam->NCU_L_ESA_STREN_H[7]     ;
	int32_t L_ESA_STREN_H_8      = ncuparam->NCU_L_ESA_STREN_H[8]     ;

	int32_t L_ESA_STREN_H;
	L_ESA_STREN_H = ncu_func_linear_insert(L_ESA_STREN_H_0,L_ESA_STREN_H_1,L_ESA_STREN_H_2,
					       L_ESA_STREN_H_3,L_ESA_STREN_H_4,L_ESA_STREN_H_5,
					       L_ESA_STREN_H_6,L_ESA_STREN_H_7,L_ESA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t L_EMA_PEAK           = ncuparam->NCU_L_EMA_PEAK           ;
	int32_t L_EMA_STREN_L        = ncuparam->NCU_L_EMA_STREN_L        ;

	int32_t L_EMA_THRES_0        = ncuparam->NCU_L_EMA_THRES[0]       ;
	int32_t L_EMA_THRES_1        = ncuparam->NCU_L_EMA_THRES[1]       ;
	int32_t L_EMA_THRES_2        = ncuparam->NCU_L_EMA_THRES[2]       ;
	int32_t L_EMA_THRES_3        = ncuparam->NCU_L_EMA_THRES[3]       ;
	int32_t L_EMA_THRES_4        = ncuparam->NCU_L_EMA_THRES[4]       ;
	int32_t L_EMA_THRES_5        = ncuparam->NCU_L_EMA_THRES[5]       ;
	int32_t L_EMA_THRES_6        = ncuparam->NCU_L_EMA_THRES[6]       ;
	int32_t L_EMA_THRES_7        = ncuparam->NCU_L_EMA_THRES[7]       ;
	int32_t L_EMA_THRES_8        = ncuparam->NCU_L_EMA_THRES[8]       ;

	int32_t L_EMA_THRES;
	L_EMA_THRES = ncu_func_linear_insert(L_EMA_THRES_0,L_EMA_THRES_1,L_EMA_THRES_2,
					     L_EMA_THRES_3,L_EMA_THRES_4,L_EMA_THRES_5,
					     L_EMA_THRES_6,L_EMA_THRES_7,L_EMA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);


	int32_t L_EMA_STREN_H_0      = ncuparam->NCU_L_EMA_STREN_H[0]     ;
	int32_t L_EMA_STREN_H_1      = ncuparam->NCU_L_EMA_STREN_H[1]     ;
	int32_t L_EMA_STREN_H_2      = ncuparam->NCU_L_EMA_STREN_H[2]     ;
	int32_t L_EMA_STREN_H_3      = ncuparam->NCU_L_EMA_STREN_H[3]     ;
	int32_t L_EMA_STREN_H_4      = ncuparam->NCU_L_EMA_STREN_H[4]     ;
	int32_t L_EMA_STREN_H_5      = ncuparam->NCU_L_EMA_STREN_H[5]     ;
	int32_t L_EMA_STREN_H_6      = ncuparam->NCU_L_EMA_STREN_H[6]     ;
	int32_t L_EMA_STREN_H_7      = ncuparam->NCU_L_EMA_STREN_H[7]     ;
	int32_t L_EMA_STREN_H_8      = ncuparam->NCU_L_EMA_STREN_H[8]     ;

	int32_t L_EMA_STREN_H;
	L_EMA_STREN_H = ncu_func_linear_insert(L_EMA_STREN_H_0,L_EMA_STREN_H_1,L_EMA_STREN_H_2,
					       L_EMA_STREN_H_3,L_EMA_STREN_H_4,L_EMA_STREN_H_5,
					       L_EMA_STREN_H_6,L_EMA_STREN_H_7,L_EMA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t L_PSA_PEAK           = ncuparam->NCU_L_PSA_PEAK           ;
	int32_t L_PSA_STREN_L        = ncuparam->NCU_L_PSA_STREN_L        ;

	int32_t L_PSA_THRES_0        = ncuparam->NCU_L_PSA_THRES[0]       ;
	int32_t L_PSA_THRES_1        = ncuparam->NCU_L_PSA_THRES[1]       ;
	int32_t L_PSA_THRES_2        = ncuparam->NCU_L_PSA_THRES[2]       ;
	int32_t L_PSA_THRES_3        = ncuparam->NCU_L_PSA_THRES[3]       ;
	int32_t L_PSA_THRES_4        = ncuparam->NCU_L_PSA_THRES[4]       ;
	int32_t L_PSA_THRES_5        = ncuparam->NCU_L_PSA_THRES[5]       ;
	int32_t L_PSA_THRES_6        = ncuparam->NCU_L_PSA_THRES[6]       ;
	int32_t L_PSA_THRES_7        = ncuparam->NCU_L_PSA_THRES[7]       ;
	int32_t L_PSA_THRES_8        = ncuparam->NCU_L_PSA_THRES[8]       ;

	int32_t L_PSA_THRES;
	L_PSA_THRES = ncu_func_linear_insert(L_PSA_THRES_0,L_PSA_THRES_1,L_PSA_THRES_2,
					     L_PSA_THRES_3,L_PSA_THRES_4,L_PSA_THRES_5,
					     L_PSA_THRES_6,L_PSA_THRES_7,L_PSA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_PSA_STREN_H_0      = ncuparam->NCU_L_PSA_STREN_H[0]     ;
	int32_t L_PSA_STREN_H_1      = ncuparam->NCU_L_PSA_STREN_H[1]     ;
	int32_t L_PSA_STREN_H_2      = ncuparam->NCU_L_PSA_STREN_H[2]     ;
	int32_t L_PSA_STREN_H_3      = ncuparam->NCU_L_PSA_STREN_H[3]     ;
	int32_t L_PSA_STREN_H_4      = ncuparam->NCU_L_PSA_STREN_H[4]     ;
	int32_t L_PSA_STREN_H_5      = ncuparam->NCU_L_PSA_STREN_H[5]     ;
	int32_t L_PSA_STREN_H_6      = ncuparam->NCU_L_PSA_STREN_H[6]     ;
	int32_t L_PSA_STREN_H_7      = ncuparam->NCU_L_PSA_STREN_H[7]     ;
	int32_t L_PSA_STREN_H_8      = ncuparam->NCU_L_PSA_STREN_H[8]     ;

	int32_t L_PSA_STREN_H;
	L_PSA_STREN_H = ncu_func_linear_insert(L_PSA_STREN_H_0,L_PSA_STREN_H_1,L_PSA_STREN_H_2,
					       L_PSA_STREN_H_3,L_PSA_STREN_H_4,L_PSA_STREN_H_5,
					       L_PSA_STREN_H_6,L_PSA_STREN_H_7,L_PSA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t L_PMA_PEAK           = ncuparam->NCU_L_PMA_PEAK           ;
	int32_t L_PMA_STREN_L        = ncuparam->NCU_L_PMA_STREN_L        ;
	int32_t L_PMA_THRES_0        = ncuparam->NCU_L_PMA_THRES[0]       ;
	int32_t L_PMA_THRES_1        = ncuparam->NCU_L_PMA_THRES[1]       ;
	int32_t L_PMA_THRES_2        = ncuparam->NCU_L_PMA_THRES[2]       ;
	int32_t L_PMA_THRES_3        = ncuparam->NCU_L_PMA_THRES[3]       ;
	int32_t L_PMA_THRES_4        = ncuparam->NCU_L_PMA_THRES[4]       ;
	int32_t L_PMA_THRES_5        = ncuparam->NCU_L_PMA_THRES[5]       ;
	int32_t L_PMA_THRES_6        = ncuparam->NCU_L_PMA_THRES[6]       ;
	int32_t L_PMA_THRES_7        = ncuparam->NCU_L_PMA_THRES[7]       ;
	int32_t L_PMA_THRES_8        = ncuparam->NCU_L_PMA_THRES[8]       ;

	int32_t L_PMA_THRES;
	L_PMA_THRES = ncu_func_linear_insert(L_PMA_THRES_0,L_PMA_THRES_1,L_PMA_THRES_2,
					     L_PMA_THRES_3,L_PMA_THRES_4,L_PMA_THRES_5,
					     L_PMA_THRES_6,L_PMA_THRES_7,L_PMA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_PMA_STREN_H_0      = ncuparam->NCU_L_PMA_STREN_H[0]     ;
	int32_t L_PMA_STREN_H_1      = ncuparam->NCU_L_PMA_STREN_H[1]     ;
	int32_t L_PMA_STREN_H_2      = ncuparam->NCU_L_PMA_STREN_H[2]     ;
	int32_t L_PMA_STREN_H_3      = ncuparam->NCU_L_PMA_STREN_H[3]     ;
	int32_t L_PMA_STREN_H_4      = ncuparam->NCU_L_PMA_STREN_H[4]     ;
	int32_t L_PMA_STREN_H_5      = ncuparam->NCU_L_PMA_STREN_H[5]     ;
	int32_t L_PMA_STREN_H_6      = ncuparam->NCU_L_PMA_STREN_H[6]     ;
	int32_t L_PMA_STREN_H_7      = ncuparam->NCU_L_PMA_STREN_H[7]     ;
	int32_t L_PMA_STREN_H_8      = ncuparam->NCU_L_PMA_STREN_H[8]     ;

	int32_t L_PMA_STREN_H;
	L_PMA_STREN_H = ncu_func_linear_insert(L_PMA_STREN_H_0,L_PMA_STREN_H_1,L_PMA_STREN_H_2,
					       L_PMA_STREN_H_3,L_PMA_STREN_H_4,L_PMA_STREN_H_5,
					       L_PMA_STREN_H_6,L_PMA_STREN_H_7,L_PMA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t L_BTA_STREN_0        = ncuparam->NCU_L_BTA_STREN[0]       ;
	int32_t L_BTA_STREN_1        = ncuparam->NCU_L_BTA_STREN[1]       ;
	int32_t L_BTA_STREN_2        = ncuparam->NCU_L_BTA_STREN[2]       ;
	int32_t L_BTA_STREN_3        = ncuparam->NCU_L_BTA_STREN[3]       ;
	int32_t L_BTA_STREN_4        = ncuparam->NCU_L_BTA_STREN[4]       ;
	int32_t L_BTA_STREN_5        = ncuparam->NCU_L_BTA_STREN[5]       ;
	int32_t L_BTA_STREN_6        = ncuparam->NCU_L_BTA_STREN[6]       ;
	int32_t L_BTA_STREN_7        = ncuparam->NCU_L_BTA_STREN[7]       ;
	int32_t L_BTA_STREN_8        = ncuparam->NCU_L_BTA_STREN[8]       ;
	int32_t L_BSA_STREN_0        = ncuparam->NCU_L_BSA_STREN[0]       ;
	int32_t L_BSA_STREN_1        = ncuparam->NCU_L_BSA_STREN[1]       ;
	int32_t L_BSA_STREN_2        = ncuparam->NCU_L_BSA_STREN[2]       ;
	int32_t L_BSA_STREN_3        = ncuparam->NCU_L_BSA_STREN[3]       ;
	int32_t L_BSA_STREN_4        = ncuparam->NCU_L_BSA_STREN[4]       ;
	int32_t L_BSA_STREN_5        = ncuparam->NCU_L_BSA_STREN[5]       ;
	int32_t L_BSA_STREN_6        = ncuparam->NCU_L_BSA_STREN[6]       ;
	int32_t L_BSA_STREN_7        = ncuparam->NCU_L_BSA_STREN[7]       ;
	int32_t L_BSA_STREN_8        = ncuparam->NCU_L_BSA_STREN[8]       ;
	int32_t L_BMA_STREN_0        = ncuparam->NCU_L_BMA_STREN[0]       ;
	int32_t L_BMA_STREN_1        = ncuparam->NCU_L_BMA_STREN[1]       ;
	int32_t L_BMA_STREN_2        = ncuparam->NCU_L_BMA_STREN[2]       ;
	int32_t L_BMA_STREN_3        = ncuparam->NCU_L_BMA_STREN[3]       ;
	int32_t L_BMA_STREN_4        = ncuparam->NCU_L_BMA_STREN[4]       ;
	int32_t L_BMA_STREN_5        = ncuparam->NCU_L_BMA_STREN[5]       ;
	int32_t L_BMA_STREN_6        = ncuparam->NCU_L_BMA_STREN[6]       ;
	int32_t L_BMA_STREN_7        = ncuparam->NCU_L_BMA_STREN[7]       ;
	int32_t L_BMA_STREN_8        = ncuparam->NCU_L_BMA_STREN[8]       ;

	int32_t L_BTA_STREN;
	L_BTA_STREN = ncu_func_linear_insert(L_BTA_STREN_0,L_BTA_STREN_1,L_BTA_STREN_2,
					     L_BTA_STREN_3,L_BTA_STREN_4,L_BTA_STREN_5,
					     L_BTA_STREN_6,L_BTA_STREN_7,L_BTA_STREN_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_BSA_STREN;
	L_BSA_STREN = ncu_func_linear_insert(L_BSA_STREN_0,L_BSA_STREN_1,L_BSA_STREN_2,
					     L_BSA_STREN_3,L_BSA_STREN_4,L_BSA_STREN_5,
					     L_BSA_STREN_6,L_BSA_STREN_7,L_BSA_STREN_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_BMA_STREN;
	L_BMA_STREN = ncu_func_linear_insert(L_BMA_STREN_0,L_BMA_STREN_1,L_BMA_STREN_2,
					     L_BMA_STREN_3,L_BMA_STREN_4,L_BMA_STREN_5,
					     L_BMA_STREN_6,L_BMA_STREN_7,L_BMA_STREN_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_TDN_TYPE_0         = ncuparam->NCU_L_TDN_TYPE[0]          ;
	int32_t L_TDN_TYPE_1         = ncuparam->NCU_L_TDN_TYPE[1]          ;
	int32_t L_TDN_TYPE_2         = ncuparam->NCU_L_TDN_TYPE[2]          ;
	int32_t L_TDN_TYPE_3         = ncuparam->NCU_L_TDN_TYPE[3]          ;
	int32_t L_TDN_TYPE_4         = ncuparam->NCU_L_TDN_TYPE[4]          ;
	int32_t L_TDN_TYPE_5         = ncuparam->NCU_L_TDN_TYPE[5]          ;
	int32_t L_TDN_TYPE_6         = ncuparam->NCU_L_TDN_TYPE[6]          ;
	int32_t L_TDN_TYPE_7         = ncuparam->NCU_L_TDN_TYPE[7]          ;
	int32_t L_TDN_TYPE_8         = ncuparam->NCU_L_TDN_TYPE[8]          ;

	int32_t L_TDN_TYPE;
	L_TDN_TYPE = ncu_func_non_linear_insert(L_TDN_TYPE_0,L_TDN_TYPE_1,L_TDN_TYPE_2,
						L_TDN_TYPE_3,L_TDN_TYPE_4,L_TDN_TYPE_5,
						L_TDN_TYPE_6,L_TDN_TYPE_7,L_TDN_TYPE_8,
						GAIN0      ,GAIN1      ,GAIN2      ,
						GAIN3      ,GAIN4      ,GAIN5      ,
						GAIN6      ,GAIN7      ,GAIN8      ,
						gain);

	int32_t L_TDN_STEP_0         = ncuparam->NCU_L_TDN_STEP[0]          ;
	int32_t L_TDN_STEP_1         = ncuparam->NCU_L_TDN_STEP[1]          ;
	int32_t L_TDN_STEP_2         = ncuparam->NCU_L_TDN_STEP[2]          ;
	int32_t L_TDN_STEP_3         = ncuparam->NCU_L_TDN_STEP[3]          ;
	int32_t L_TDN_STEP_4         = ncuparam->NCU_L_TDN_STEP[4]          ;
	int32_t L_TDN_STEP_5         = ncuparam->NCU_L_TDN_STEP[5]          ;
	int32_t L_TDN_STEP_6         = ncuparam->NCU_L_TDN_STEP[6]          ;
	int32_t L_TDN_STEP_7         = ncuparam->NCU_L_TDN_STEP[7]          ;
	int32_t L_TDN_STEP_8         = ncuparam->NCU_L_TDN_STEP[8]          ;

	int32_t L_TDN_STEP;
	L_TDN_STEP = ncu_func_linear_insert(L_TDN_STEP_0,L_TDN_STEP_1,L_TDN_STEP_2,
					    L_TDN_STEP_3,L_TDN_STEP_4,L_TDN_STEP_5,
					    L_TDN_STEP_6,L_TDN_STEP_7,L_TDN_STEP_8,
					    GAIN0      ,GAIN1      ,GAIN2      ,
					    GAIN3      ,GAIN4      ,GAIN5      ,
					    GAIN6      ,GAIN7      ,GAIN8      ,
					    gain);

	int32_t L_TDN_RISEL_0        = ncuparam->NCU_L_TDN_RISEL[0]         ;
	int32_t L_TDN_RISEL_1        = ncuparam->NCU_L_TDN_RISEL[1]         ;
	int32_t L_TDN_RISEL_2        = ncuparam->NCU_L_TDN_RISEL[2]         ;
	int32_t L_TDN_RISEL_3        = ncuparam->NCU_L_TDN_RISEL[3]         ;
	int32_t L_TDN_RISEL_4        = ncuparam->NCU_L_TDN_RISEL[4]         ;
	int32_t L_TDN_RISEL_5        = ncuparam->NCU_L_TDN_RISEL[5]         ;
	int32_t L_TDN_RISEL_6        = ncuparam->NCU_L_TDN_RISEL[6]         ;
	int32_t L_TDN_RISEL_7        = ncuparam->NCU_L_TDN_RISEL[7]         ;
	int32_t L_TDN_RISEL_8        = ncuparam->NCU_L_TDN_RISEL[8]         ;

	int32_t L_TDN_RISEL ;
	L_TDN_RISEL = ncu_func_non_linear_insert(L_TDN_RISEL_0,L_TDN_RISEL_1,L_TDN_RISEL_2,
						 L_TDN_RISEL_3,L_TDN_RISEL_4,L_TDN_RISEL_5,
						 L_TDN_RISEL_6,L_TDN_RISEL_7,L_TDN_RISEL_8,
						 GAIN0        ,GAIN1        ,GAIN2        ,
						 GAIN3        ,GAIN4        ,GAIN5        ,
						 GAIN6        ,GAIN7        ,GAIN8        ,
						 gain);

	int32_t L_TDN_MAXNUM_0       = ncuparam->NCU_L_TDN_MAXNUM[0]        ;
	int32_t L_TDN_MAXNUM_1       = ncuparam->NCU_L_TDN_MAXNUM[1]        ;
	int32_t L_TDN_MAXNUM_2       = ncuparam->NCU_L_TDN_MAXNUM[2]        ;
	int32_t L_TDN_MAXNUM_3       = ncuparam->NCU_L_TDN_MAXNUM[3]        ;
	int32_t L_TDN_MAXNUM_4       = ncuparam->NCU_L_TDN_MAXNUM[4]        ;
	int32_t L_TDN_MAXNUM_5       = ncuparam->NCU_L_TDN_MAXNUM[5]        ;
	int32_t L_TDN_MAXNUM_6       = ncuparam->NCU_L_TDN_MAXNUM[6]        ;
	int32_t L_TDN_MAXNUM_7       = ncuparam->NCU_L_TDN_MAXNUM[7]        ;
	int32_t L_TDN_MAXNUM_8       = ncuparam->NCU_L_TDN_MAXNUM[8]        ;

	int32_t L_TDN_MAXNUM;
	L_TDN_MAXNUM = ncu_func_linear_insert(L_TDN_MAXNUM_0,L_TDN_MAXNUM_1,L_TDN_MAXNUM_2,
					      L_TDN_MAXNUM_3,L_TDN_MAXNUM_4,L_TDN_MAXNUM_5,
					      L_TDN_MAXNUM_6,L_TDN_MAXNUM_7,L_TDN_MAXNUM_8,
					      GAIN0      ,GAIN1      ,GAIN2      ,
					      GAIN3      ,GAIN4      ,GAIN5      ,
					      GAIN6      ,GAIN7      ,GAIN8      ,
					      gain);

	int32_t L_TDN_BDV_ADJ_1_0    = ncuparam->NCU_L_TDN_BDV_ADJ_1[0]   ;
	int32_t L_TDN_BDV_ADJ_1_1    = ncuparam->NCU_L_TDN_BDV_ADJ_1[1]   ;
	int32_t L_TDN_BDV_ADJ_1_2    = ncuparam->NCU_L_TDN_BDV_ADJ_1[2]   ;
	int32_t L_TDN_BDV_ADJ_1_3    = ncuparam->NCU_L_TDN_BDV_ADJ_1[3]   ;
	int32_t L_TDN_BDV_ADJ_1_4    = ncuparam->NCU_L_TDN_BDV_ADJ_1[4]   ;
	int32_t L_TDN_BDV_ADJ_1_5    = ncuparam->NCU_L_TDN_BDV_ADJ_1[5]   ;
	int32_t L_TDN_BDV_ADJ_1_6    = ncuparam->NCU_L_TDN_BDV_ADJ_1[6]   ;
	int32_t L_TDN_BDV_ADJ_1_7    = ncuparam->NCU_L_TDN_BDV_ADJ_1[7]   ;
	int32_t L_TDN_BDV_ADJ_1_8    = ncuparam->NCU_L_TDN_BDV_ADJ_1[8]   ;

	int32_t L_TDN_BDV_ADJ_2_0    = ncuparam->NCU_L_TDN_BDV_ADJ_2[0]   ;
	int32_t L_TDN_BDV_ADJ_2_1    = ncuparam->NCU_L_TDN_BDV_ADJ_2[1]   ;
	int32_t L_TDN_BDV_ADJ_2_2    = ncuparam->NCU_L_TDN_BDV_ADJ_2[2]   ;
	int32_t L_TDN_BDV_ADJ_2_3    = ncuparam->NCU_L_TDN_BDV_ADJ_2[3]   ;
	int32_t L_TDN_BDV_ADJ_2_4    = ncuparam->NCU_L_TDN_BDV_ADJ_2[4]   ;
	int32_t L_TDN_BDV_ADJ_2_5    = ncuparam->NCU_L_TDN_BDV_ADJ_2[5]   ;
	int32_t L_TDN_BDV_ADJ_2_6    = ncuparam->NCU_L_TDN_BDV_ADJ_2[6]   ;
	int32_t L_TDN_BDV_ADJ_2_7    = ncuparam->NCU_L_TDN_BDV_ADJ_2[7]   ;
	int32_t L_TDN_BDV_ADJ_2_8    = ncuparam->NCU_L_TDN_BDV_ADJ_2[8]   ;

	int32_t L_TDN_BDV_ADJ_3_0    = ncuparam->NCU_L_TDN_BDV_ADJ_3[0]   ;
	int32_t L_TDN_BDV_ADJ_3_1    = ncuparam->NCU_L_TDN_BDV_ADJ_3[1]   ;
	int32_t L_TDN_BDV_ADJ_3_2    = ncuparam->NCU_L_TDN_BDV_ADJ_3[2]   ;
	int32_t L_TDN_BDV_ADJ_3_3    = ncuparam->NCU_L_TDN_BDV_ADJ_3[3]   ;
	int32_t L_TDN_BDV_ADJ_3_4    = ncuparam->NCU_L_TDN_BDV_ADJ_3[4]   ;
	int32_t L_TDN_BDV_ADJ_3_5    = ncuparam->NCU_L_TDN_BDV_ADJ_3[5]   ;
	int32_t L_TDN_BDV_ADJ_3_6    = ncuparam->NCU_L_TDN_BDV_ADJ_3[6]   ;
	int32_t L_TDN_BDV_ADJ_3_7    = ncuparam->NCU_L_TDN_BDV_ADJ_3[7]   ;
	int32_t L_TDN_BDV_ADJ_3_8    = ncuparam->NCU_L_TDN_BDV_ADJ_3[8]   ;

	int32_t L_TDN_BDV_ADJ_4_0    = ncuparam->NCU_L_TDN_BDV_ADJ_4[0]   ;
	int32_t L_TDN_BDV_ADJ_4_1    = ncuparam->NCU_L_TDN_BDV_ADJ_4[1]   ;
	int32_t L_TDN_BDV_ADJ_4_2    = ncuparam->NCU_L_TDN_BDV_ADJ_4[2]   ;
	int32_t L_TDN_BDV_ADJ_4_3    = ncuparam->NCU_L_TDN_BDV_ADJ_4[3]   ;
	int32_t L_TDN_BDV_ADJ_4_4    = ncuparam->NCU_L_TDN_BDV_ADJ_4[4]   ;
	int32_t L_TDN_BDV_ADJ_4_5    = ncuparam->NCU_L_TDN_BDV_ADJ_4[5]   ;
	int32_t L_TDN_BDV_ADJ_4_6    = ncuparam->NCU_L_TDN_BDV_ADJ_4[6]   ;
	int32_t L_TDN_BDV_ADJ_4_7    = ncuparam->NCU_L_TDN_BDV_ADJ_4[7]   ;
	int32_t L_TDN_BDV_ADJ_4_8    = ncuparam->NCU_L_TDN_BDV_ADJ_4[8]   ;

	int32_t L_TDN_BDV_ADJ_5_0    = ncuparam->NCU_L_TDN_BDV_ADJ_5[0]   ;
	int32_t L_TDN_BDV_ADJ_5_1    = ncuparam->NCU_L_TDN_BDV_ADJ_5[1]   ;
	int32_t L_TDN_BDV_ADJ_5_2    = ncuparam->NCU_L_TDN_BDV_ADJ_5[2]   ;
	int32_t L_TDN_BDV_ADJ_5_3    = ncuparam->NCU_L_TDN_BDV_ADJ_5[3]   ;
	int32_t L_TDN_BDV_ADJ_5_4    = ncuparam->NCU_L_TDN_BDV_ADJ_5[4]   ;
	int32_t L_TDN_BDV_ADJ_5_5    = ncuparam->NCU_L_TDN_BDV_ADJ_5[5]   ;
	int32_t L_TDN_BDV_ADJ_5_6    = ncuparam->NCU_L_TDN_BDV_ADJ_5[6]   ;
	int32_t L_TDN_BDV_ADJ_5_7    = ncuparam->NCU_L_TDN_BDV_ADJ_5[7]   ;
	int32_t L_TDN_BDV_ADJ_5_8    = ncuparam->NCU_L_TDN_BDV_ADJ_5[8]   ;

	int32_t L_TDN_BDV_ADJ_1 ;
	L_TDN_BDV_ADJ_1 = ncu_func_linear_insert(L_TDN_BDV_ADJ_1_0,L_TDN_BDV_ADJ_1_1,L_TDN_BDV_ADJ_1_2,
						 L_TDN_BDV_ADJ_1_3,L_TDN_BDV_ADJ_1_4,L_TDN_BDV_ADJ_1_5,
						 L_TDN_BDV_ADJ_1_6,L_TDN_BDV_ADJ_1_7,L_TDN_BDV_ADJ_1_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t L_TDN_BDV_ADJ_2 ;
	L_TDN_BDV_ADJ_2 = ncu_func_linear_insert(L_TDN_BDV_ADJ_2_0,L_TDN_BDV_ADJ_2_1,L_TDN_BDV_ADJ_2_2,
						 L_TDN_BDV_ADJ_2_3,L_TDN_BDV_ADJ_2_4,L_TDN_BDV_ADJ_2_5,
						 L_TDN_BDV_ADJ_2_6,L_TDN_BDV_ADJ_2_7,L_TDN_BDV_ADJ_2_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t L_TDN_BDV_ADJ_3 ;
	L_TDN_BDV_ADJ_3 = ncu_func_linear_insert(L_TDN_BDV_ADJ_3_0,L_TDN_BDV_ADJ_3_1,L_TDN_BDV_ADJ_3_2,
						 L_TDN_BDV_ADJ_3_3,L_TDN_BDV_ADJ_3_4,L_TDN_BDV_ADJ_3_5,
						 L_TDN_BDV_ADJ_3_6,L_TDN_BDV_ADJ_3_7,L_TDN_BDV_ADJ_3_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t L_TDN_BDV_ADJ_4 ;
	L_TDN_BDV_ADJ_4 = ncu_func_linear_insert(L_TDN_BDV_ADJ_4_0,L_TDN_BDV_ADJ_4_1,L_TDN_BDV_ADJ_4_2,
						 L_TDN_BDV_ADJ_4_3,L_TDN_BDV_ADJ_4_4,L_TDN_BDV_ADJ_4_5,
						 L_TDN_BDV_ADJ_4_6,L_TDN_BDV_ADJ_4_7,L_TDN_BDV_ADJ_4_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t L_TDN_BDV_ADJ_5 ;
	L_TDN_BDV_ADJ_5 = ncu_func_linear_insert(L_TDN_BDV_ADJ_5_0,L_TDN_BDV_ADJ_5_1,L_TDN_BDV_ADJ_5_2,
						 L_TDN_BDV_ADJ_5_3,L_TDN_BDV_ADJ_5_4,L_TDN_BDV_ADJ_5_5,
						 L_TDN_BDV_ADJ_5_6,L_TDN_BDV_ADJ_5_7,L_TDN_BDV_ADJ_5_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t L_TDN_WIN_0          = ncuparam->NCU_L_TDN_WIN[0]         ;
	int32_t L_TDN_WIN_1          = ncuparam->NCU_L_TDN_WIN[1]         ;
	int32_t L_TDN_WIN_2          = ncuparam->NCU_L_TDN_WIN[2]         ;
	int32_t L_TDN_WIN_3          = ncuparam->NCU_L_TDN_WIN[3]         ;
	int32_t L_TDN_WIN_4          = ncuparam->NCU_L_TDN_WIN[4]         ;
	int32_t L_TDN_WIN_5          = ncuparam->NCU_L_TDN_WIN[5]         ;
	int32_t L_TDN_WIN_6          = ncuparam->NCU_L_TDN_WIN[6]         ;
	int32_t L_TDN_WIN_7          = ncuparam->NCU_L_TDN_WIN[7]         ;
	int32_t L_TDN_WIN_8          = ncuparam->NCU_L_TDN_WIN[8]         ;

	int32_t L_TDN_WIN;
	L_TDN_WIN = ncu_func_non_linear_insert(L_TDN_WIN_0,L_TDN_WIN_1,L_TDN_WIN_2,
					       L_TDN_WIN_3,L_TDN_WIN_4,L_TDN_WIN_5,
					       L_TDN_WIN_6,L_TDN_WIN_7,L_TDN_WIN_8,
					       GAIN0      ,GAIN1      ,GAIN2      ,
					       GAIN3      ,GAIN4      ,GAIN5      ,
					       GAIN6      ,GAIN7      ,GAIN8      ,
					       gain);

	int32_t L_TDN_LEVEL_0        = ncuparam->NCU_L_TDN_LEVEL[0]       ;
	int32_t L_TDN_LEVEL_1        = ncuparam->NCU_L_TDN_LEVEL[1]       ;
	int32_t L_TDN_LEVEL_2        = ncuparam->NCU_L_TDN_LEVEL[2]       ;
	int32_t L_TDN_LEVEL_3        = ncuparam->NCU_L_TDN_LEVEL[3]       ;
	int32_t L_TDN_LEVEL_4        = ncuparam->NCU_L_TDN_LEVEL[4]       ;
	int32_t L_TDN_LEVEL_5        = ncuparam->NCU_L_TDN_LEVEL[5]       ;
	int32_t L_TDN_LEVEL_6        = ncuparam->NCU_L_TDN_LEVEL[6]       ;
	int32_t L_TDN_LEVEL_7        = ncuparam->NCU_L_TDN_LEVEL[7]       ;
	int32_t L_TDN_LEVEL_8        = ncuparam->NCU_L_TDN_LEVEL[8]       ;

	int32_t L_TDN_LEVEL ;
	L_TDN_LEVEL = ncu_func_linear_insert(L_TDN_LEVEL_0,L_TDN_LEVEL_1,L_TDN_LEVEL_2,
					     L_TDN_LEVEL_3,L_TDN_LEVEL_4,L_TDN_LEVEL_5,
					     L_TDN_LEVEL_6,L_TDN_LEVEL_7,L_TDN_LEVEL_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_TDN_NUM_0          = ncuparam->NCU_L_TDN_NUM[0]         ;
	int32_t L_TDN_NUM_1          = ncuparam->NCU_L_TDN_NUM[1]         ;
	int32_t L_TDN_NUM_2          = ncuparam->NCU_L_TDN_NUM[2]         ;
	int32_t L_TDN_NUM_3          = ncuparam->NCU_L_TDN_NUM[3]         ;
	int32_t L_TDN_NUM_4          = ncuparam->NCU_L_TDN_NUM[4]         ;
	int32_t L_TDN_NUM_5          = ncuparam->NCU_L_TDN_NUM[5]         ;
	int32_t L_TDN_NUM_6          = ncuparam->NCU_L_TDN_NUM[6]         ;
	int32_t L_TDN_NUM_7          = ncuparam->NCU_L_TDN_NUM[7]         ;
	int32_t L_TDN_NUM_8          = ncuparam->NCU_L_TDN_NUM[8]         ;

	int32_t L_TDN_NUM;
	L_TDN_NUM = ncu_func_linear_insert(L_TDN_NUM_0,L_TDN_NUM_1,L_TDN_NUM_2,
					   L_TDN_NUM_3,L_TDN_NUM_4,L_TDN_NUM_5,
					   L_TDN_NUM_6,L_TDN_NUM_7,L_TDN_NUM_8,
					   GAIN0      ,GAIN1      ,GAIN2      ,
					   GAIN3      ,GAIN4      ,GAIN5      ,
					   GAIN6      ,GAIN7      ,GAIN8      ,
					   gain);

	int32_t L_TDN_LMT_0          = ncuparam->NCU_L_TDN_LMT[0]         ;
	int32_t L_TDN_LMT_1          = ncuparam->NCU_L_TDN_LMT[1]         ;
	int32_t L_TDN_LMT_2          = ncuparam->NCU_L_TDN_LMT[2]         ;
	int32_t L_TDN_LMT_3          = ncuparam->NCU_L_TDN_LMT[3]         ;
	int32_t L_TDN_LMT_4          = ncuparam->NCU_L_TDN_LMT[4]         ;
	int32_t L_TDN_LMT_5          = ncuparam->NCU_L_TDN_LMT[5]         ;
	int32_t L_TDN_LMT_6          = ncuparam->NCU_L_TDN_LMT[6]         ;
	int32_t L_TDN_LMT_7          = ncuparam->NCU_L_TDN_LMT[7]         ;
	int32_t L_TDN_LMT_8          = ncuparam->NCU_L_TDN_LMT[8]         ;

	int32_t L_TDN_LMT;
	L_TDN_LMT = ncu_func_linear_insert(L_TDN_LMT_0,L_TDN_LMT_1,L_TDN_LMT_2,
					   L_TDN_LMT_3,L_TDN_LMT_4,L_TDN_LMT_5,
					   L_TDN_LMT_6,L_TDN_LMT_7,L_TDN_LMT_8,
					   GAIN0      ,GAIN1      ,GAIN2      ,
					   GAIN3      ,GAIN4      ,GAIN5      ,
					   GAIN6      ,GAIN7      ,GAIN8      ,
					   gain);

	int32_t L_TDN_PEAK_0         = ncuparam->NCU_L_TDN_PEAK[0]        ;
	int32_t L_TDN_PEAK_1         = ncuparam->NCU_L_TDN_PEAK[1]        ;
	int32_t L_TDN_PEAK_2         = ncuparam->NCU_L_TDN_PEAK[2]        ;
	int32_t L_TDN_PEAK_3         = ncuparam->NCU_L_TDN_PEAK[3]        ;
	int32_t L_TDN_PEAK_4         = ncuparam->NCU_L_TDN_PEAK[4]        ;
	int32_t L_TDN_PEAK_5         = ncuparam->NCU_L_TDN_PEAK[5]        ;
	int32_t L_TDN_PEAK_6         = ncuparam->NCU_L_TDN_PEAK[6]        ;
	int32_t L_TDN_PEAK_7         = ncuparam->NCU_L_TDN_PEAK[7]        ;
	int32_t L_TDN_PEAK_8         = ncuparam->NCU_L_TDN_PEAK[8]        ;

	int32_t L_TDN_PEAK;
	L_TDN_PEAK = ncu_func_linear_insert(L_TDN_PEAK_0,L_TDN_PEAK_1,L_TDN_PEAK_2,
					    L_TDN_PEAK_3,L_TDN_PEAK_4,L_TDN_PEAK_5,
					    L_TDN_PEAK_6,L_TDN_PEAK_7,L_TDN_PEAK_8,
					    GAIN0       ,GAIN1       ,GAIN2       ,
					    GAIN3       ,GAIN4       ,GAIN5       ,
					    GAIN6       ,GAIN7       ,GAIN8       ,
					    gain);

	int32_t L_TDN_STREN_L_0      = ncuparam->NCU_L_TDN_STREN_L[0]     ;
	int32_t L_TDN_STREN_L_1      = ncuparam->NCU_L_TDN_STREN_L[1]     ;
	int32_t L_TDN_STREN_L_2      = ncuparam->NCU_L_TDN_STREN_L[2]     ;
	int32_t L_TDN_STREN_L_3      = ncuparam->NCU_L_TDN_STREN_L[3]     ;
	int32_t L_TDN_STREN_L_4      = ncuparam->NCU_L_TDN_STREN_L[4]     ;
	int32_t L_TDN_STREN_L_5      = ncuparam->NCU_L_TDN_STREN_L[5]     ;
	int32_t L_TDN_STREN_L_6      = ncuparam->NCU_L_TDN_STREN_L[6]     ;
	int32_t L_TDN_STREN_L_7      = ncuparam->NCU_L_TDN_STREN_L[7]     ;
	int32_t L_TDN_STREN_L_8      = ncuparam->NCU_L_TDN_STREN_L[8]     ;

	int32_t L_TDN_STREN_L ;
	L_TDN_STREN_L = ncu_func_linear_insert(L_TDN_STREN_L_0,L_TDN_STREN_L_1,L_TDN_STREN_L_2,
					       L_TDN_STREN_L_3,L_TDN_STREN_L_4,L_TDN_STREN_L_5,
					       L_TDN_STREN_L_6,L_TDN_STREN_L_7,L_TDN_STREN_L_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t L_TDN_THRES_0        = ncuparam->NCU_L_TDN_THRES[0]       ;
	int32_t L_TDN_THRES_1        = ncuparam->NCU_L_TDN_THRES[1]       ;
	int32_t L_TDN_THRES_2        = ncuparam->NCU_L_TDN_THRES[2]       ;
	int32_t L_TDN_THRES_3        = ncuparam->NCU_L_TDN_THRES[3]       ;
	int32_t L_TDN_THRES_4        = ncuparam->NCU_L_TDN_THRES[4]       ;
	int32_t L_TDN_THRES_5        = ncuparam->NCU_L_TDN_THRES[5]       ;
	int32_t L_TDN_THRES_6        = ncuparam->NCU_L_TDN_THRES[6]       ;
	int32_t L_TDN_THRES_7        = ncuparam->NCU_L_TDN_THRES[7]       ;
	int32_t L_TDN_THRES_8        = ncuparam->NCU_L_TDN_THRES[8]       ;

	int32_t L_TDN_THRES;
	L_TDN_THRES = ncu_func_linear_insert(L_TDN_THRES_0,L_TDN_THRES_1,L_TDN_THRES_2,
					     L_TDN_THRES_3,L_TDN_THRES_4,L_TDN_THRES_5,
					     L_TDN_THRES_6,L_TDN_THRES_7,L_TDN_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t L_TDN_STREN_H_0      = ncuparam->NCU_L_TDN_STREN_H[0]     ;
	int32_t L_TDN_STREN_H_1      = ncuparam->NCU_L_TDN_STREN_H[1]     ;
	int32_t L_TDN_STREN_H_2      = ncuparam->NCU_L_TDN_STREN_H[2]     ;
	int32_t L_TDN_STREN_H_3      = ncuparam->NCU_L_TDN_STREN_H[3]     ;
	int32_t L_TDN_STREN_H_4      = ncuparam->NCU_L_TDN_STREN_H[4]     ;
	int32_t L_TDN_STREN_H_5      = ncuparam->NCU_L_TDN_STREN_H[5]     ;
	int32_t L_TDN_STREN_H_6      = ncuparam->NCU_L_TDN_STREN_H[6]     ;
	int32_t L_TDN_STREN_H_7      = ncuparam->NCU_L_TDN_STREN_H[7]     ;
	int32_t L_TDN_STREN_H_8      = ncuparam->NCU_L_TDN_STREN_H[8]     ;

	int32_t L_TDN_STREN_H ;
	L_TDN_STREN_H = ncu_func_linear_insert(L_TDN_STREN_H_0,L_TDN_STREN_H_1,L_TDN_STREN_H_2,
					       L_TDN_STREN_H_3,L_TDN_STREN_H_4,L_TDN_STREN_H_5,
					       L_TDN_STREN_H_6,L_TDN_STREN_H_7,L_TDN_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t L_TDN_SBASE_0        = ncuparam->NCU_L_TDN_SBASE[0]       ;
	int32_t L_TDN_SBASE_1        = ncuparam->NCU_L_TDN_SBASE[1]       ;
	int32_t L_TDN_SBASE_2        = ncuparam->NCU_L_TDN_SBASE[2]       ;
	int32_t L_TDN_SBASE_3        = ncuparam->NCU_L_TDN_SBASE[3]       ;
	int32_t L_TDN_SBASE_4        = ncuparam->NCU_L_TDN_SBASE[4]       ;
	int32_t L_TDN_SBASE_5        = ncuparam->NCU_L_TDN_SBASE[5]       ;
	int32_t L_TDN_SBASE_6        = ncuparam->NCU_L_TDN_SBASE[6]       ;
	int32_t L_TDN_SBASE_7        = ncuparam->NCU_L_TDN_SBASE[7]       ;
	int32_t L_TDN_SBASE_8        = ncuparam->NCU_L_TDN_SBASE[8]       ;

	int32_t L_TDN_SBASE ;
	L_TDN_SBASE = ncu_func_linear_insert(L_TDN_SBASE_0,L_TDN_SBASE_1,L_TDN_SBASE_2,
					     L_TDN_SBASE_3,L_TDN_SBASE_4,L_TDN_SBASE_5,
					     L_TDN_SBASE_6,L_TDN_SBASE_7,L_TDN_SBASE_8,
					     GAIN0          ,GAIN1          ,GAIN2          ,
					     GAIN3          ,GAIN4          ,GAIN5          ,
					     GAIN6          ,GAIN7          ,GAIN8          ,
					     gain);

	int32_t L_SDN_STREN_P_0      = ncuparam->NCU_L_SDN_STREN_P[0]     ;
	int32_t L_SDN_STREN_P_1      = ncuparam->NCU_L_SDN_STREN_P[1]     ;
	int32_t L_SDN_STREN_P_2      = ncuparam->NCU_L_SDN_STREN_P[2]     ;
	int32_t L_SDN_STREN_P_3      = ncuparam->NCU_L_SDN_STREN_P[3]     ;
	int32_t L_SDN_STREN_P_4      = ncuparam->NCU_L_SDN_STREN_P[4]     ;
	int32_t L_SDN_STREN_P_5      = ncuparam->NCU_L_SDN_STREN_P[5]     ;
	int32_t L_SDN_STREN_P_6      = ncuparam->NCU_L_SDN_STREN_P[6]     ;
	int32_t L_SDN_STREN_P_7      = ncuparam->NCU_L_SDN_STREN_P[7]     ;
	int32_t L_SDN_STREN_P_8      = ncuparam->NCU_L_SDN_STREN_P[8]     ;

	int32_t L_SDN_STREN_G_0      = ncuparam->NCU_L_SDN_STREN_G[0]     ;
	int32_t L_SDN_STREN_G_1      = ncuparam->NCU_L_SDN_STREN_G[1]     ;
	int32_t L_SDN_STREN_G_2      = ncuparam->NCU_L_SDN_STREN_G[2]     ;
	int32_t L_SDN_STREN_G_3      = ncuparam->NCU_L_SDN_STREN_G[3]     ;
	int32_t L_SDN_STREN_G_4      = ncuparam->NCU_L_SDN_STREN_G[4]     ;
	int32_t L_SDN_STREN_G_5      = ncuparam->NCU_L_SDN_STREN_G[5]     ;
	int32_t L_SDN_STREN_G_6      = ncuparam->NCU_L_SDN_STREN_G[6]     ;
	int32_t L_SDN_STREN_G_7      = ncuparam->NCU_L_SDN_STREN_G[7]     ;
	int32_t L_SDN_STREN_G_8      = ncuparam->NCU_L_SDN_STREN_G[8]     ;

	int32_t L_SDN_STREN_P;
	L_SDN_STREN_P = ncu_func_linear_insert(L_SDN_STREN_P_0,L_SDN_STREN_P_1,L_SDN_STREN_P_2,
					       L_SDN_STREN_P_3,L_SDN_STREN_P_4,L_SDN_STREN_P_5,
					       L_SDN_STREN_P_6,L_SDN_STREN_P_7,L_SDN_STREN_P_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t L_SDN_STREN_G;
	L_SDN_STREN_G = ncu_func_linear_insert(L_SDN_STREN_G_0,L_SDN_STREN_G_1,L_SDN_STREN_G_2,
					       L_SDN_STREN_G_3,L_SDN_STREN_G_4,L_SDN_STREN_G_5,
					       L_SDN_STREN_G_6,L_SDN_STREN_G_7,L_SDN_STREN_G_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t C_TDN_EN             = ncuparam->NCU_C_TDN_EN             ;
	int32_t C_LCK_EN             = ncuparam->NCU_C_LCK_EN             ;

	int32_t C_CNA_THRES          = ncuparam->NCU_C_CNA_THRES          ;
	int32_t C_CNA_STREN          = ncuparam->NCU_C_CNA_STREN          ;

	int32_t C_SMJ_THRES_0        = ncuparam->NCU_C_SMJ_THRES[0]       ;
	int32_t C_SMJ_THRES_1        = ncuparam->NCU_C_SMJ_THRES[1]       ;
	int32_t C_SMJ_THRES_2        = ncuparam->NCU_C_SMJ_THRES[2]       ;
	int32_t C_SMJ_THRES_3        = ncuparam->NCU_C_SMJ_THRES[3]       ;
	int32_t C_SMJ_THRES_4        = ncuparam->NCU_C_SMJ_THRES[4]       ;
	int32_t C_SMJ_THRES_5        = ncuparam->NCU_C_SMJ_THRES[5]       ;
	int32_t C_SMJ_THRES_6        = ncuparam->NCU_C_SMJ_THRES[6]       ;
	int32_t C_SMJ_THRES_7        = ncuparam->NCU_C_SMJ_THRES[7]       ;
	int32_t C_SMJ_THRES_8        = ncuparam->NCU_C_SMJ_THRES[8]       ;

	int32_t C_SMJ_THRES ;
	C_SMJ_THRES = ncu_func_linear_insert(C_SMJ_THRES_0,C_SMJ_THRES_1,C_SMJ_THRES_2,
					     C_SMJ_THRES_3,C_SMJ_THRES_4,C_SMJ_THRES_5,
					     C_SMJ_THRES_6,C_SMJ_THRES_7,C_SMJ_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_OSB_THRES          = ncuparam->NCU_C_OSB_THRES          ;
	int32_t C_OSB_SLOPE          = ncuparam->NCU_C_OSB_SLOPE          ;
	int32_t C_OSD_THRES          = ncuparam->NCU_C_OSD_THRES          ;
	int32_t C_OSD_SLOPE          = ncuparam->NCU_C_OSD_SLOPE          ;
	int32_t C_OMB_THRES          = ncuparam->NCU_C_OMB_THRES          ;
	int32_t C_OMB_SLOPE          = ncuparam->NCU_C_OMB_SLOPE          ;
	int32_t C_OMD_THRES          = ncuparam->NCU_C_OMD_THRES          ;
	int32_t C_OMD_SLOPE          = ncuparam->NCU_C_OMD_SLOPE          ;

	int32_t C_EDG_TYPE           = ncuparam->NCU_C_EDG_TYPE           ;
	int32_t C_EDG_DIFF_SLOPE_0   = ncuparam->NCU_C_EDG_DIFF_SLOPE[0]  ;
	int32_t C_EDG_DIFF_SLOPE_1   = ncuparam->NCU_C_EDG_DIFF_SLOPE[1]  ;
	int32_t C_EDG_DIFF_SLOPE_2   = ncuparam->NCU_C_EDG_DIFF_SLOPE[2]  ;
	int32_t C_EDG_DIFF_SLOPE_3   = ncuparam->NCU_C_EDG_DIFF_SLOPE[3]  ;
	int32_t C_EDG_DIFF_SLOPE_4   = ncuparam->NCU_C_EDG_DIFF_SLOPE[4]  ;
	int32_t C_EDG_DIFF_SLOPE_5   = ncuparam->NCU_C_EDG_DIFF_SLOPE[5]  ;
	int32_t C_EDG_DIFF_SLOPE_6   = ncuparam->NCU_C_EDG_DIFF_SLOPE[6]  ;
	int32_t C_EDG_DIFF_SLOPE_7   = ncuparam->NCU_C_EDG_DIFF_SLOPE[7]  ;
	int32_t C_EDG_DIFF_SLOPE_8   = ncuparam->NCU_C_EDG_DIFF_SLOPE[8]  ;

	int32_t C_EDG_DIFF_SLOPE ;
	C_EDG_DIFF_SLOPE = ncu_func_linear_insert(C_EDG_DIFF_SLOPE_0,C_EDG_DIFF_SLOPE_1,C_EDG_DIFF_SLOPE_2,
						  C_EDG_DIFF_SLOPE_3,C_EDG_DIFF_SLOPE_4,C_EDG_DIFF_SLOPE_5,
						  C_EDG_DIFF_SLOPE_6,C_EDG_DIFF_SLOPE_7,C_EDG_DIFF_SLOPE_8,
						  GAIN0        ,GAIN1        ,GAIN2        ,
						  GAIN3        ,GAIN4        ,GAIN5        ,
						  GAIN6        ,GAIN7        ,GAIN8        ,
						  gain);

	int32_t C_EDG_DIFF_LOW_0     = ncuparam->NCU_C_EDG_DIFF_LOW[0]    ;
	int32_t C_EDG_DIFF_LOW_1     = ncuparam->NCU_C_EDG_DIFF_LOW[1]    ;
	int32_t C_EDG_DIFF_LOW_2     = ncuparam->NCU_C_EDG_DIFF_LOW[2]    ;
	int32_t C_EDG_DIFF_LOW_3     = ncuparam->NCU_C_EDG_DIFF_LOW[3]    ;
	int32_t C_EDG_DIFF_LOW_4     = ncuparam->NCU_C_EDG_DIFF_LOW[4]    ;
	int32_t C_EDG_DIFF_LOW_5     = ncuparam->NCU_C_EDG_DIFF_LOW[5]    ;
	int32_t C_EDG_DIFF_LOW_6     = ncuparam->NCU_C_EDG_DIFF_LOW[6]    ;
	int32_t C_EDG_DIFF_LOW_7     = ncuparam->NCU_C_EDG_DIFF_LOW[7]    ;
	int32_t C_EDG_DIFF_LOW_8     = ncuparam->NCU_C_EDG_DIFF_LOW[8]    ;

	int32_t C_EDG_DIFF_LOW ;
	C_EDG_DIFF_LOW = ncu_func_linear_insert(C_EDG_DIFF_LOW_0,C_EDG_DIFF_LOW_1,C_EDG_DIFF_LOW_2,
						C_EDG_DIFF_LOW_3,C_EDG_DIFF_LOW_4,C_EDG_DIFF_LOW_5,
						C_EDG_DIFF_LOW_6,C_EDG_DIFF_LOW_7,C_EDG_DIFF_LOW_8,
						GAIN0        ,GAIN1        ,GAIN2        ,
						GAIN3        ,GAIN4        ,GAIN5        ,
						GAIN6        ,GAIN7        ,GAIN8        ,
						gain);

	int32_t C_EDG_DIFF_HIGH_0    = ncuparam->NCU_C_EDG_DIFF_HIGH[0]   ;
	int32_t C_EDG_DIFF_HIGH_1    = ncuparam->NCU_C_EDG_DIFF_HIGH[1]   ;
	int32_t C_EDG_DIFF_HIGH_2    = ncuparam->NCU_C_EDG_DIFF_HIGH[2]   ;
	int32_t C_EDG_DIFF_HIGH_3    = ncuparam->NCU_C_EDG_DIFF_HIGH[3]   ;
	int32_t C_EDG_DIFF_HIGH_4    = ncuparam->NCU_C_EDG_DIFF_HIGH[4]   ;
	int32_t C_EDG_DIFF_HIGH_5    = ncuparam->NCU_C_EDG_DIFF_HIGH[5]   ;
	int32_t C_EDG_DIFF_HIGH_6    = ncuparam->NCU_C_EDG_DIFF_HIGH[6]   ;
	int32_t C_EDG_DIFF_HIGH_7    = ncuparam->NCU_C_EDG_DIFF_HIGH[7]   ;
	int32_t C_EDG_DIFF_HIGH_8    = ncuparam->NCU_C_EDG_DIFF_HIGH[8]   ;

	int32_t C_EDG_DIFF_HIGH ;
	C_EDG_DIFF_HIGH = ncu_func_linear_insert(C_EDG_DIFF_HIGH_0,C_EDG_DIFF_HIGH_1,C_EDG_DIFF_HIGH_2,
						 C_EDG_DIFF_HIGH_3,C_EDG_DIFF_HIGH_4,C_EDG_DIFF_HIGH_5,
						 C_EDG_DIFF_HIGH_6,C_EDG_DIFF_HIGH_7,C_EDG_DIFF_HIGH_8,
						 GAIN0        ,GAIN1        ,GAIN2        ,
						 GAIN3        ,GAIN4        ,GAIN5        ,
						 GAIN6        ,GAIN7        ,GAIN8        ,
						 gain);

	int32_t C_ESA_PEAK           = ncuparam->NCU_C_ESA_PEAK           ;
	int32_t C_ESA_STREN_L        = ncuparam->NCU_C_ESA_STREN_L        ;

	int32_t C_ESA_THRES_0        = ncuparam->NCU_C_ESA_THRES[0]       ;
	int32_t C_ESA_THRES_1        = ncuparam->NCU_C_ESA_THRES[1]       ;
	int32_t C_ESA_THRES_2        = ncuparam->NCU_C_ESA_THRES[2]       ;
	int32_t C_ESA_THRES_3        = ncuparam->NCU_C_ESA_THRES[3]       ;
	int32_t C_ESA_THRES_4        = ncuparam->NCU_C_ESA_THRES[4]       ;
	int32_t C_ESA_THRES_5        = ncuparam->NCU_C_ESA_THRES[5]       ;
	int32_t C_ESA_THRES_6        = ncuparam->NCU_C_ESA_THRES[6]       ;
	int32_t C_ESA_THRES_7        = ncuparam->NCU_C_ESA_THRES[7]       ;
	int32_t C_ESA_THRES_8        = ncuparam->NCU_C_ESA_THRES[8]       ;

	int32_t C_ESA_THRES;
	C_ESA_THRES = ncu_func_linear_insert(C_ESA_THRES_0,C_ESA_THRES_1,C_ESA_THRES_2,
					     C_ESA_THRES_3,C_ESA_THRES_4,C_ESA_THRES_5,
					     C_ESA_THRES_6,C_ESA_THRES_7,C_ESA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_ESA_STREN_H_0      = ncuparam->NCU_C_ESA_STREN_H[0]     ;
	int32_t C_ESA_STREN_H_1      = ncuparam->NCU_C_ESA_STREN_H[1]     ;
	int32_t C_ESA_STREN_H_2      = ncuparam->NCU_C_ESA_STREN_H[2]     ;
	int32_t C_ESA_STREN_H_3      = ncuparam->NCU_C_ESA_STREN_H[3]     ;
	int32_t C_ESA_STREN_H_4      = ncuparam->NCU_C_ESA_STREN_H[4]     ;
	int32_t C_ESA_STREN_H_5      = ncuparam->NCU_C_ESA_STREN_H[5]     ;
	int32_t C_ESA_STREN_H_6      = ncuparam->NCU_C_ESA_STREN_H[6]     ;
	int32_t C_ESA_STREN_H_7      = ncuparam->NCU_C_ESA_STREN_H[7]     ;
	int32_t C_ESA_STREN_H_8      = ncuparam->NCU_C_ESA_STREN_H[8]     ;

	int32_t C_ESA_STREN_H;
	C_ESA_STREN_H = ncu_func_linear_insert(C_ESA_STREN_H_0,C_ESA_STREN_H_1,C_ESA_STREN_H_2,
					       C_ESA_STREN_H_3,C_ESA_STREN_H_4,C_ESA_STREN_H_5,
					       C_ESA_STREN_H_6,C_ESA_STREN_H_7,C_ESA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t C_EMA_PEAK           = ncuparam->NCU_C_EMA_PEAK           ;
	int32_t C_EMA_STREN_L        = ncuparam->NCU_C_EMA_STREN_L        ;

	int32_t C_EMA_THRES_0        = ncuparam->NCU_C_EMA_THRES[0]       ;
	int32_t C_EMA_THRES_1        = ncuparam->NCU_C_EMA_THRES[1]       ;
	int32_t C_EMA_THRES_2        = ncuparam->NCU_C_EMA_THRES[2]       ;
	int32_t C_EMA_THRES_3        = ncuparam->NCU_C_EMA_THRES[3]       ;
	int32_t C_EMA_THRES_4        = ncuparam->NCU_C_EMA_THRES[4]       ;
	int32_t C_EMA_THRES_5        = ncuparam->NCU_C_EMA_THRES[5]       ;
	int32_t C_EMA_THRES_6        = ncuparam->NCU_C_EMA_THRES[6]       ;
	int32_t C_EMA_THRES_7        = ncuparam->NCU_C_EMA_THRES[7]       ;
	int32_t C_EMA_THRES_8        = ncuparam->NCU_C_EMA_THRES[8]       ;

	int32_t C_EMA_THRES;
	C_EMA_THRES = ncu_func_linear_insert(C_EMA_THRES_0,C_EMA_THRES_1,C_EMA_THRES_2,
					     C_EMA_THRES_3,C_EMA_THRES_4,C_EMA_THRES_5,
					     C_EMA_THRES_6,C_EMA_THRES_7,C_EMA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_EMA_STREN_H_0      = ncuparam->NCU_C_EMA_STREN_H[0]     ;
	int32_t C_EMA_STREN_H_1      = ncuparam->NCU_C_EMA_STREN_H[1]     ;
	int32_t C_EMA_STREN_H_2      = ncuparam->NCU_C_EMA_STREN_H[2]     ;
	int32_t C_EMA_STREN_H_3      = ncuparam->NCU_C_EMA_STREN_H[3]     ;
	int32_t C_EMA_STREN_H_4      = ncuparam->NCU_C_EMA_STREN_H[4]     ;
	int32_t C_EMA_STREN_H_5      = ncuparam->NCU_C_EMA_STREN_H[5]     ;
	int32_t C_EMA_STREN_H_6      = ncuparam->NCU_C_EMA_STREN_H[6]     ;
	int32_t C_EMA_STREN_H_7      = ncuparam->NCU_C_EMA_STREN_H[7]     ;
	int32_t C_EMA_STREN_H_8      = ncuparam->NCU_C_EMA_STREN_H[8]     ;

	int32_t C_EMA_STREN_H;
	C_EMA_STREN_H = ncu_func_linear_insert(C_EMA_STREN_H_0,C_EMA_STREN_H_1,C_EMA_STREN_H_2,
					       C_EMA_STREN_H_3,C_EMA_STREN_H_4,C_EMA_STREN_H_5,
					       C_EMA_STREN_H_6,C_EMA_STREN_H_7,C_EMA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t C_PSA_PEAK           = ncuparam->NCU_C_PSA_PEAK           ;
	int32_t C_PSA_STREN_L        = ncuparam->NCU_C_PSA_STREN_L        ;
	int32_t C_PSA_THRES_0        = ncuparam->NCU_C_PSA_THRES[0]       ;
	int32_t C_PSA_THRES_1        = ncuparam->NCU_C_PSA_THRES[1]       ;
	int32_t C_PSA_THRES_2        = ncuparam->NCU_C_PSA_THRES[2]       ;
	int32_t C_PSA_THRES_3        = ncuparam->NCU_C_PSA_THRES[3]       ;
	int32_t C_PSA_THRES_4        = ncuparam->NCU_C_PSA_THRES[4]       ;
	int32_t C_PSA_THRES_5        = ncuparam->NCU_C_PSA_THRES[5]       ;
	int32_t C_PSA_THRES_6        = ncuparam->NCU_C_PSA_THRES[6]       ;
	int32_t C_PSA_THRES_7        = ncuparam->NCU_C_PSA_THRES[7]       ;
	int32_t C_PSA_THRES_8        = ncuparam->NCU_C_PSA_THRES[8]       ;
	int32_t C_PSA_STREN_H_0      = ncuparam->NCU_C_PSA_STREN_H[0]     ;
	int32_t C_PSA_STREN_H_1      = ncuparam->NCU_C_PSA_STREN_H[1]     ;
	int32_t C_PSA_STREN_H_2      = ncuparam->NCU_C_PSA_STREN_H[2]     ;
	int32_t C_PSA_STREN_H_3      = ncuparam->NCU_C_PSA_STREN_H[3]     ;
	int32_t C_PSA_STREN_H_4      = ncuparam->NCU_C_PSA_STREN_H[4]     ;
	int32_t C_PSA_STREN_H_5      = ncuparam->NCU_C_PSA_STREN_H[5]     ;
	int32_t C_PSA_STREN_H_6      = ncuparam->NCU_C_PSA_STREN_H[6]     ;
	int32_t C_PSA_STREN_H_7      = ncuparam->NCU_C_PSA_STREN_H[7]     ;
	int32_t C_PSA_STREN_H_8      = ncuparam->NCU_C_PSA_STREN_H[8]     ;

	int32_t C_PSA_THRES;
	C_PSA_THRES = ncu_func_linear_insert(C_PSA_THRES_0,C_PSA_THRES_1,C_PSA_THRES_2,
					     C_PSA_THRES_3,C_PSA_THRES_4,C_PSA_THRES_5,
					     C_PSA_THRES_6,C_PSA_THRES_7,C_PSA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_PSA_STREN_H;
	C_PSA_STREN_H = ncu_func_linear_insert(C_PSA_STREN_H_0,C_PSA_STREN_H_1,C_PSA_STREN_H_2,
					       C_PSA_STREN_H_3,C_PSA_STREN_H_4,C_PSA_STREN_H_5,
					       C_PSA_STREN_H_6,C_PSA_STREN_H_7,C_PSA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t C_PMA_PEAK           = ncuparam->NCU_C_PMA_PEAK           ;
	int32_t C_PMA_STREN_L        = ncuparam->NCU_C_PMA_STREN_L        ;
	int32_t C_PMA_THRES_0        = ncuparam->NCU_C_PMA_THRES[0]       ;
	int32_t C_PMA_THRES_1        = ncuparam->NCU_C_PMA_THRES[1]       ;
	int32_t C_PMA_THRES_2        = ncuparam->NCU_C_PMA_THRES[2]       ;
	int32_t C_PMA_THRES_3        = ncuparam->NCU_C_PMA_THRES[3]       ;
	int32_t C_PMA_THRES_4        = ncuparam->NCU_C_PMA_THRES[4]       ;
	int32_t C_PMA_THRES_5        = ncuparam->NCU_C_PMA_THRES[5]       ;
	int32_t C_PMA_THRES_6        = ncuparam->NCU_C_PMA_THRES[6]       ;
	int32_t C_PMA_THRES_7        = ncuparam->NCU_C_PMA_THRES[7]       ;
	int32_t C_PMA_THRES_8        = ncuparam->NCU_C_PMA_THRES[8]       ;
	int32_t C_PMA_STREN_H_0      = ncuparam->NCU_C_PMA_STREN_H[0]     ;
	int32_t C_PMA_STREN_H_1      = ncuparam->NCU_C_PMA_STREN_H[1]     ;
	int32_t C_PMA_STREN_H_2      = ncuparam->NCU_C_PMA_STREN_H[2]     ;
	int32_t C_PMA_STREN_H_3      = ncuparam->NCU_C_PMA_STREN_H[3]     ;
	int32_t C_PMA_STREN_H_4      = ncuparam->NCU_C_PMA_STREN_H[4]     ;
	int32_t C_PMA_STREN_H_5      = ncuparam->NCU_C_PMA_STREN_H[5]     ;
	int32_t C_PMA_STREN_H_6      = ncuparam->NCU_C_PMA_STREN_H[6]     ;
	int32_t C_PMA_STREN_H_7      = ncuparam->NCU_C_PMA_STREN_H[7]     ;
	int32_t C_PMA_STREN_H_8      = ncuparam->NCU_C_PMA_STREN_H[8]     ;

	int32_t C_PMA_THRES;
	C_PMA_THRES = ncu_func_linear_insert(C_PMA_THRES_0,C_PMA_THRES_1,C_PMA_THRES_2,
					     C_PMA_THRES_3,C_PMA_THRES_4,C_PMA_THRES_5,
					     C_PMA_THRES_6,C_PMA_THRES_7,C_PMA_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_PMA_STREN_H;
	C_PMA_STREN_H = ncu_func_linear_insert(C_PMA_STREN_H_0,C_PMA_STREN_H_1,C_PMA_STREN_H_2,
					       C_PMA_STREN_H_3,C_PMA_STREN_H_4,C_PMA_STREN_H_5,
					       C_PMA_STREN_H_6,C_PMA_STREN_H_7,C_PMA_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t C_BSA_STREN_0        = ncuparam->NCU_C_BSA_STREN[0]       ;
	int32_t C_BSA_STREN_1        = ncuparam->NCU_C_BSA_STREN[1]       ;
	int32_t C_BSA_STREN_2        = ncuparam->NCU_C_BSA_STREN[2]       ;
	int32_t C_BSA_STREN_3        = ncuparam->NCU_C_BSA_STREN[3]       ;
	int32_t C_BSA_STREN_4        = ncuparam->NCU_C_BSA_STREN[4]       ;
	int32_t C_BSA_STREN_5        = ncuparam->NCU_C_BSA_STREN[5]       ;
	int32_t C_BSA_STREN_6        = ncuparam->NCU_C_BSA_STREN[6]       ;
	int32_t C_BSA_STREN_7        = ncuparam->NCU_C_BSA_STREN[7]       ;
	int32_t C_BSA_STREN_8        = ncuparam->NCU_C_BSA_STREN[8]       ;
	int32_t C_BMA_STREN_0        = ncuparam->NCU_C_BMA_STREN[0]       ;
	int32_t C_BMA_STREN_1        = ncuparam->NCU_C_BMA_STREN[1]       ;
	int32_t C_BMA_STREN_2        = ncuparam->NCU_C_BMA_STREN[2]       ;
	int32_t C_BMA_STREN_3        = ncuparam->NCU_C_BMA_STREN[3]       ;
	int32_t C_BMA_STREN_4        = ncuparam->NCU_C_BMA_STREN[4]       ;
	int32_t C_BMA_STREN_5        = ncuparam->NCU_C_BMA_STREN[5]       ;
	int32_t C_BMA_STREN_6        = ncuparam->NCU_C_BMA_STREN[6]       ;
	int32_t C_BMA_STREN_7        = ncuparam->NCU_C_BMA_STREN[7]       ;
	int32_t C_BMA_STREN_8        = ncuparam->NCU_C_BMA_STREN[8]       ;

	int32_t C_BSA_STREN;
	C_BSA_STREN = ncu_func_linear_insert(C_BSA_STREN_0,C_BSA_STREN_1,C_BSA_STREN_2,
					     C_BSA_STREN_3,C_BSA_STREN_4,C_BSA_STREN_5,
					     C_BSA_STREN_6,C_BSA_STREN_7,C_BSA_STREN_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_BMA_STREN;
	C_BMA_STREN = ncu_func_linear_insert(C_BMA_STREN_0,C_BMA_STREN_1,C_BMA_STREN_2,
					     C_BMA_STREN_3,C_BMA_STREN_4,C_BMA_STREN_5,
					     C_BMA_STREN_6,C_BMA_STREN_7,C_BMA_STREN_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_TDN_TYPE_0         = ncuparam->NCU_C_TDN_TYPE[0]          ;
	int32_t C_TDN_TYPE_1         = ncuparam->NCU_C_TDN_TYPE[1]          ;
	int32_t C_TDN_TYPE_2         = ncuparam->NCU_C_TDN_TYPE[2]          ;
	int32_t C_TDN_TYPE_3         = ncuparam->NCU_C_TDN_TYPE[3]          ;
	int32_t C_TDN_TYPE_4         = ncuparam->NCU_C_TDN_TYPE[4]          ;
	int32_t C_TDN_TYPE_5         = ncuparam->NCU_C_TDN_TYPE[5]          ;
	int32_t C_TDN_TYPE_6         = ncuparam->NCU_C_TDN_TYPE[6]          ;
	int32_t C_TDN_TYPE_7         = ncuparam->NCU_C_TDN_TYPE[7]          ;
	int32_t C_TDN_TYPE_8         = ncuparam->NCU_C_TDN_TYPE[8]          ;

	int32_t C_TDN_TYPE;
	C_TDN_TYPE = ncu_func_non_linear_insert(C_TDN_TYPE_0,C_TDN_TYPE_1,C_TDN_TYPE_2,
						C_TDN_TYPE_3,C_TDN_TYPE_4,C_TDN_TYPE_5,
						C_TDN_TYPE_6,C_TDN_TYPE_7,C_TDN_TYPE_8,
						GAIN0      ,GAIN1      ,GAIN2      ,
						GAIN3      ,GAIN4      ,GAIN5      ,
						GAIN6      ,GAIN7      ,GAIN8      ,
						gain);

	int32_t C_TDN_STEP_0         = ncuparam->NCU_C_TDN_STEP[0]          ;
	int32_t C_TDN_STEP_1         = ncuparam->NCU_C_TDN_STEP[1]          ;
	int32_t C_TDN_STEP_2         = ncuparam->NCU_C_TDN_STEP[2]          ;
	int32_t C_TDN_STEP_3         = ncuparam->NCU_C_TDN_STEP[3]          ;
	int32_t C_TDN_STEP_4         = ncuparam->NCU_C_TDN_STEP[4]          ;
	int32_t C_TDN_STEP_5         = ncuparam->NCU_C_TDN_STEP[5]          ;
	int32_t C_TDN_STEP_6         = ncuparam->NCU_C_TDN_STEP[6]          ;
	int32_t C_TDN_STEP_7         = ncuparam->NCU_C_TDN_STEP[7]          ;
	int32_t C_TDN_STEP_8         = ncuparam->NCU_C_TDN_STEP[8]          ;

	int32_t C_TDN_STEP;
	C_TDN_STEP = ncu_func_linear_insert(C_TDN_STEP_0,C_TDN_STEP_1,C_TDN_STEP_2,
					    C_TDN_STEP_3,C_TDN_STEP_4,C_TDN_STEP_5,
					    C_TDN_STEP_6,C_TDN_STEP_7,C_TDN_STEP_8,
					    GAIN0      ,GAIN1      ,GAIN2      ,
					    GAIN3      ,GAIN4      ,GAIN5      ,
					    GAIN6      ,GAIN7      ,GAIN8      ,
					    gain);
#if 0
	int32_t C_TDN_RISEL_0        = ncuparam->NCU_C_TDN_RISEL[0]         ;
	int32_t C_TDN_RISEL_1        = ncuparam->NCU_C_TDN_RISEL[1]         ;
	int32_t C_TDN_RISEL_2        = ncuparam->NCU_C_TDN_RISEL[2]         ;
	int32_t C_TDN_RISEL_3        = ncuparam->NCU_C_TDN_RISEL[3]         ;
	int32_t C_TDN_RISEL_4        = ncuparam->NCU_C_TDN_RISEL[4]         ;
	int32_t C_TDN_RISEL_5        = ncuparam->NCU_C_TDN_RISEL[5]         ;
	int32_t C_TDN_RISEL_6        = ncuparam->NCU_C_TDN_RISEL[6]         ;
	int32_t C_TDN_RISEL_7        = ncuparam->NCU_C_TDN_RISEL[7]         ;
	int32_t C_TDN_RISEL_8        = ncuparam->NCU_C_TDN_RISEL[8]         ;

	int32_t C_TDN_RISEL ;
	C_TDN_RISEL = ncu_func_non_linear_insert(C_TDN_RISEL_0,C_TDN_RISEL_1,C_TDN_RISEL_2,
						 C_TDN_RISEL_3,C_TDN_RISEL_4,C_TDN_RISEL_5,
						 C_TDN_RISEL_6,C_TDN_RISEL_7,C_TDN_RISEL_8,
						 GAIN0        ,GAIN1        ,GAIN2        ,
						 GAIN3        ,GAIN4        ,GAIN5        ,
						 GAIN6        ,GAIN7        ,GAIN8        ,
						 gain);
#endif
	int32_t C_TDN_MAXNUM_0       = ncuparam->NCU_C_TDN_MAXNUM[0]        ;
	int32_t C_TDN_MAXNUM_1       = ncuparam->NCU_C_TDN_MAXNUM[1]        ;
	int32_t C_TDN_MAXNUM_2       = ncuparam->NCU_C_TDN_MAXNUM[2]        ;
	int32_t C_TDN_MAXNUM_3       = ncuparam->NCU_C_TDN_MAXNUM[3]        ;
	int32_t C_TDN_MAXNUM_4       = ncuparam->NCU_C_TDN_MAXNUM[4]        ;
	int32_t C_TDN_MAXNUM_5       = ncuparam->NCU_C_TDN_MAXNUM[5]        ;
	int32_t C_TDN_MAXNUM_6       = ncuparam->NCU_C_TDN_MAXNUM[6]        ;
	int32_t C_TDN_MAXNUM_7       = ncuparam->NCU_C_TDN_MAXNUM[7]        ;
	int32_t C_TDN_MAXNUM_8       = ncuparam->NCU_C_TDN_MAXNUM[8]        ;

	int32_t C_TDN_MAXNUM;
	C_TDN_MAXNUM = ncu_func_linear_insert(C_TDN_MAXNUM_0,C_TDN_MAXNUM_1,C_TDN_MAXNUM_2,
					      C_TDN_MAXNUM_3,C_TDN_MAXNUM_4,C_TDN_MAXNUM_5,
					      C_TDN_MAXNUM_6,C_TDN_MAXNUM_7,C_TDN_MAXNUM_8,
					      GAIN0      ,GAIN1      ,GAIN2      ,
					      GAIN3      ,GAIN4      ,GAIN5      ,
					      GAIN6      ,GAIN7      ,GAIN8      ,
					      gain);

	int32_t C_TDN_BDV_ADJ_1_0    = ncuparam->NCU_C_TDN_BDV_ADJ_1[0]   ;
	int32_t C_TDN_BDV_ADJ_1_1    = ncuparam->NCU_C_TDN_BDV_ADJ_1[1]   ;
	int32_t C_TDN_BDV_ADJ_1_2    = ncuparam->NCU_C_TDN_BDV_ADJ_1[2]   ;
	int32_t C_TDN_BDV_ADJ_1_3    = ncuparam->NCU_C_TDN_BDV_ADJ_1[3]   ;
	int32_t C_TDN_BDV_ADJ_1_4    = ncuparam->NCU_C_TDN_BDV_ADJ_1[4]   ;
	int32_t C_TDN_BDV_ADJ_1_5    = ncuparam->NCU_C_TDN_BDV_ADJ_1[5]   ;
	int32_t C_TDN_BDV_ADJ_1_6    = ncuparam->NCU_C_TDN_BDV_ADJ_1[6]   ;
	int32_t C_TDN_BDV_ADJ_1_7    = ncuparam->NCU_C_TDN_BDV_ADJ_1[7]   ;
	int32_t C_TDN_BDV_ADJ_1_8    = ncuparam->NCU_C_TDN_BDV_ADJ_1[8]   ;

	int32_t C_TDN_BDV_ADJ_2_0    = ncuparam->NCU_C_TDN_BDV_ADJ_2[0]   ;
	int32_t C_TDN_BDV_ADJ_2_1    = ncuparam->NCU_C_TDN_BDV_ADJ_2[1]   ;
	int32_t C_TDN_BDV_ADJ_2_2    = ncuparam->NCU_C_TDN_BDV_ADJ_2[2]   ;
	int32_t C_TDN_BDV_ADJ_2_3    = ncuparam->NCU_C_TDN_BDV_ADJ_2[3]   ;
	int32_t C_TDN_BDV_ADJ_2_4    = ncuparam->NCU_C_TDN_BDV_ADJ_2[4]   ;
	int32_t C_TDN_BDV_ADJ_2_5    = ncuparam->NCU_C_TDN_BDV_ADJ_2[5]   ;
	int32_t C_TDN_BDV_ADJ_2_6    = ncuparam->NCU_C_TDN_BDV_ADJ_2[6]   ;
	int32_t C_TDN_BDV_ADJ_2_7    = ncuparam->NCU_C_TDN_BDV_ADJ_2[7]   ;
	int32_t C_TDN_BDV_ADJ_2_8    = ncuparam->NCU_C_TDN_BDV_ADJ_2[8]   ;

	int32_t C_TDN_BDV_ADJ_3_0    = ncuparam->NCU_C_TDN_BDV_ADJ_3[0]   ;
	int32_t C_TDN_BDV_ADJ_3_1    = ncuparam->NCU_C_TDN_BDV_ADJ_3[1]   ;
	int32_t C_TDN_BDV_ADJ_3_2    = ncuparam->NCU_C_TDN_BDV_ADJ_3[2]   ;
	int32_t C_TDN_BDV_ADJ_3_3    = ncuparam->NCU_C_TDN_BDV_ADJ_3[3]   ;
	int32_t C_TDN_BDV_ADJ_3_4    = ncuparam->NCU_C_TDN_BDV_ADJ_3[4]   ;
	int32_t C_TDN_BDV_ADJ_3_5    = ncuparam->NCU_C_TDN_BDV_ADJ_3[5]   ;
	int32_t C_TDN_BDV_ADJ_3_6    = ncuparam->NCU_C_TDN_BDV_ADJ_3[6]   ;
	int32_t C_TDN_BDV_ADJ_3_7    = ncuparam->NCU_C_TDN_BDV_ADJ_3[7]   ;
	int32_t C_TDN_BDV_ADJ_3_8    = ncuparam->NCU_C_TDN_BDV_ADJ_3[8]   ;

	int32_t C_TDN_BDV_ADJ_4_0    = ncuparam->NCU_C_TDN_BDV_ADJ_4[0]   ;
	int32_t C_TDN_BDV_ADJ_4_1    = ncuparam->NCU_C_TDN_BDV_ADJ_4[1]   ;
	int32_t C_TDN_BDV_ADJ_4_2    = ncuparam->NCU_C_TDN_BDV_ADJ_4[2]   ;
	int32_t C_TDN_BDV_ADJ_4_3    = ncuparam->NCU_C_TDN_BDV_ADJ_4[3]   ;
	int32_t C_TDN_BDV_ADJ_4_4    = ncuparam->NCU_C_TDN_BDV_ADJ_4[4]   ;
	int32_t C_TDN_BDV_ADJ_4_5    = ncuparam->NCU_C_TDN_BDV_ADJ_4[5]   ;
	int32_t C_TDN_BDV_ADJ_4_6    = ncuparam->NCU_C_TDN_BDV_ADJ_4[6]   ;
	int32_t C_TDN_BDV_ADJ_4_7    = ncuparam->NCU_C_TDN_BDV_ADJ_4[7]   ;
	int32_t C_TDN_BDV_ADJ_4_8    = ncuparam->NCU_C_TDN_BDV_ADJ_4[8]   ;

	int32_t C_TDN_BDV_ADJ_5_0    = ncuparam->NCU_C_TDN_BDV_ADJ_5[0]   ;
	int32_t C_TDN_BDV_ADJ_5_1    = ncuparam->NCU_C_TDN_BDV_ADJ_5[1]   ;
	int32_t C_TDN_BDV_ADJ_5_2    = ncuparam->NCU_C_TDN_BDV_ADJ_5[2]   ;
	int32_t C_TDN_BDV_ADJ_5_3    = ncuparam->NCU_C_TDN_BDV_ADJ_5[3]   ;
	int32_t C_TDN_BDV_ADJ_5_4    = ncuparam->NCU_C_TDN_BDV_ADJ_5[4]   ;
	int32_t C_TDN_BDV_ADJ_5_5    = ncuparam->NCU_C_TDN_BDV_ADJ_5[5]   ;
	int32_t C_TDN_BDV_ADJ_5_6    = ncuparam->NCU_C_TDN_BDV_ADJ_5[6]   ;
	int32_t C_TDN_BDV_ADJ_5_7    = ncuparam->NCU_C_TDN_BDV_ADJ_5[7]   ;
	int32_t C_TDN_BDV_ADJ_5_8    = ncuparam->NCU_C_TDN_BDV_ADJ_5[8]   ;

	int32_t C_TDN_BDV_ADJ_1 ;
	C_TDN_BDV_ADJ_1 = ncu_func_linear_insert(C_TDN_BDV_ADJ_1_0,C_TDN_BDV_ADJ_1_1,C_TDN_BDV_ADJ_1_2,
						 C_TDN_BDV_ADJ_1_3,C_TDN_BDV_ADJ_1_4,C_TDN_BDV_ADJ_1_5,
						 C_TDN_BDV_ADJ_1_6,C_TDN_BDV_ADJ_1_7,C_TDN_BDV_ADJ_1_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t C_TDN_BDV_ADJ_2 ;
	C_TDN_BDV_ADJ_2 = ncu_func_linear_insert(C_TDN_BDV_ADJ_2_0,C_TDN_BDV_ADJ_2_1,C_TDN_BDV_ADJ_2_2,
						 C_TDN_BDV_ADJ_2_3,C_TDN_BDV_ADJ_2_4,C_TDN_BDV_ADJ_2_5,
						 C_TDN_BDV_ADJ_2_6,C_TDN_BDV_ADJ_2_7,C_TDN_BDV_ADJ_2_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t C_TDN_BDV_ADJ_3 ;
	C_TDN_BDV_ADJ_3 = ncu_func_linear_insert(C_TDN_BDV_ADJ_3_0,C_TDN_BDV_ADJ_3_1,C_TDN_BDV_ADJ_3_2,
						 C_TDN_BDV_ADJ_3_3,C_TDN_BDV_ADJ_3_4,C_TDN_BDV_ADJ_3_5,
						 C_TDN_BDV_ADJ_3_6,C_TDN_BDV_ADJ_3_7,C_TDN_BDV_ADJ_3_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t C_TDN_BDV_ADJ_4 ;
	C_TDN_BDV_ADJ_4 = ncu_func_linear_insert(C_TDN_BDV_ADJ_4_0,C_TDN_BDV_ADJ_4_1,C_TDN_BDV_ADJ_4_2,
						 C_TDN_BDV_ADJ_4_3,C_TDN_BDV_ADJ_4_4,C_TDN_BDV_ADJ_4_5,
						 C_TDN_BDV_ADJ_4_6,C_TDN_BDV_ADJ_4_7,C_TDN_BDV_ADJ_4_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t C_TDN_BDV_ADJ_5 ;
	C_TDN_BDV_ADJ_5 = ncu_func_linear_insert(C_TDN_BDV_ADJ_5_0,C_TDN_BDV_ADJ_5_1,C_TDN_BDV_ADJ_5_2,
						 C_TDN_BDV_ADJ_5_3,C_TDN_BDV_ADJ_5_4,C_TDN_BDV_ADJ_5_5,
						 C_TDN_BDV_ADJ_5_6,C_TDN_BDV_ADJ_5_7,C_TDN_BDV_ADJ_5_8,
						 GAIN0          ,GAIN1          ,GAIN2          ,
						 GAIN3          ,GAIN4          ,GAIN5          ,
						 GAIN6          ,GAIN7          ,GAIN8          ,
						 gain);

	int32_t C_TDN_WIN_0          = ncuparam->NCU_C_TDN_WIN[0]         ;
	int32_t C_TDN_WIN_1          = ncuparam->NCU_C_TDN_WIN[1]         ;
	int32_t C_TDN_WIN_2          = ncuparam->NCU_C_TDN_WIN[2]         ;
	int32_t C_TDN_WIN_3          = ncuparam->NCU_C_TDN_WIN[3]         ;
	int32_t C_TDN_WIN_4          = ncuparam->NCU_C_TDN_WIN[4]         ;
	int32_t C_TDN_WIN_5          = ncuparam->NCU_C_TDN_WIN[5]         ;
	int32_t C_TDN_WIN_6          = ncuparam->NCU_C_TDN_WIN[6]         ;
	int32_t C_TDN_WIN_7          = ncuparam->NCU_C_TDN_WIN[7]         ;
	int32_t C_TDN_WIN_8          = ncuparam->NCU_C_TDN_WIN[8]         ;

	int32_t C_TDN_WIN;
	C_TDN_WIN = ncu_func_non_linear_insert(C_TDN_WIN_0,C_TDN_WIN_1,C_TDN_WIN_2,
					       C_TDN_WIN_3,C_TDN_WIN_4,C_TDN_WIN_5,
					       C_TDN_WIN_6,C_TDN_WIN_7,C_TDN_WIN_8,
					       GAIN0      ,GAIN1      ,GAIN2      ,
					       GAIN3      ,GAIN4      ,GAIN5      ,
					       GAIN6      ,GAIN7      ,GAIN8      ,
					       gain);

	int32_t C_TDN_LEVEL_0        = ncuparam->NCU_C_TDN_LEVEL[0]       ;
	int32_t C_TDN_LEVEL_1        = ncuparam->NCU_C_TDN_LEVEL[1]       ;
	int32_t C_TDN_LEVEL_2        = ncuparam->NCU_C_TDN_LEVEL[2]       ;
	int32_t C_TDN_LEVEL_3        = ncuparam->NCU_C_TDN_LEVEL[3]       ;
	int32_t C_TDN_LEVEL_4        = ncuparam->NCU_C_TDN_LEVEL[4]       ;
	int32_t C_TDN_LEVEL_5        = ncuparam->NCU_C_TDN_LEVEL[5]       ;
	int32_t C_TDN_LEVEL_6        = ncuparam->NCU_C_TDN_LEVEL[6]       ;
	int32_t C_TDN_LEVEL_7        = ncuparam->NCU_C_TDN_LEVEL[7]       ;
	int32_t C_TDN_LEVEL_8        = ncuparam->NCU_C_TDN_LEVEL[8]       ;

	int32_t C_TDN_LEVEL ;
	C_TDN_LEVEL = ncu_func_linear_insert(C_TDN_LEVEL_0,C_TDN_LEVEL_1,C_TDN_LEVEL_2,
					     C_TDN_LEVEL_3,C_TDN_LEVEL_4,C_TDN_LEVEL_5,
					     C_TDN_LEVEL_6,C_TDN_LEVEL_7,C_TDN_LEVEL_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_TDN_NUM_0          = ncuparam->NCU_C_TDN_NUM[0]         ;
	int32_t C_TDN_NUM_1          = ncuparam->NCU_C_TDN_NUM[1]         ;
	int32_t C_TDN_NUM_2          = ncuparam->NCU_C_TDN_NUM[2]         ;
	int32_t C_TDN_NUM_3          = ncuparam->NCU_C_TDN_NUM[3]         ;
	int32_t C_TDN_NUM_4          = ncuparam->NCU_C_TDN_NUM[4]         ;
	int32_t C_TDN_NUM_5          = ncuparam->NCU_C_TDN_NUM[5]         ;
	int32_t C_TDN_NUM_6          = ncuparam->NCU_C_TDN_NUM[6]         ;
	int32_t C_TDN_NUM_7          = ncuparam->NCU_C_TDN_NUM[7]         ;
	int32_t C_TDN_NUM_8          = ncuparam->NCU_C_TDN_NUM[8]         ;

	int32_t C_TDN_NUM;
	C_TDN_NUM = ncu_func_linear_insert(C_TDN_NUM_0,C_TDN_NUM_1,C_TDN_NUM_2,
					   C_TDN_NUM_3,C_TDN_NUM_4,C_TDN_NUM_5,
					   C_TDN_NUM_6,C_TDN_NUM_7,C_TDN_NUM_8,
					   GAIN0      ,GAIN1      ,GAIN2      ,
					   GAIN3      ,GAIN4      ,GAIN5      ,
					   GAIN6      ,GAIN7      ,GAIN8      ,
					   gain);

	int32_t C_TDN_LMT_0          = ncuparam->NCU_C_TDN_LMT[0]         ;
	int32_t C_TDN_LMT_1          = ncuparam->NCU_C_TDN_LMT[1]         ;
	int32_t C_TDN_LMT_2          = ncuparam->NCU_C_TDN_LMT[2]         ;
	int32_t C_TDN_LMT_3          = ncuparam->NCU_C_TDN_LMT[3]         ;
	int32_t C_TDN_LMT_4          = ncuparam->NCU_C_TDN_LMT[4]         ;
	int32_t C_TDN_LMT_5          = ncuparam->NCU_C_TDN_LMT[5]         ;
	int32_t C_TDN_LMT_6          = ncuparam->NCU_C_TDN_LMT[6]         ;
	int32_t C_TDN_LMT_7          = ncuparam->NCU_C_TDN_LMT[7]         ;
	int32_t C_TDN_LMT_8          = ncuparam->NCU_C_TDN_LMT[8]         ;

	int32_t C_TDN_LMT;
	C_TDN_LMT = ncu_func_linear_insert(C_TDN_LMT_0,C_TDN_LMT_1,C_TDN_LMT_2,
					   C_TDN_LMT_3,C_TDN_LMT_4,C_TDN_LMT_5,
					   C_TDN_LMT_6,C_TDN_LMT_7,C_TDN_LMT_8,
					   GAIN0      ,GAIN1      ,GAIN2      ,
					   GAIN3      ,GAIN4      ,GAIN5      ,
					   GAIN6      ,GAIN7      ,GAIN8      ,
					   gain);

	int32_t C_TDN_PEAK_0         = ncuparam->NCU_C_TDN_PEAK[0]        ;
	int32_t C_TDN_PEAK_1         = ncuparam->NCU_C_TDN_PEAK[1]        ;
	int32_t C_TDN_PEAK_2         = ncuparam->NCU_C_TDN_PEAK[2]        ;
	int32_t C_TDN_PEAK_3         = ncuparam->NCU_C_TDN_PEAK[3]        ;
	int32_t C_TDN_PEAK_4         = ncuparam->NCU_C_TDN_PEAK[4]        ;
	int32_t C_TDN_PEAK_5         = ncuparam->NCU_C_TDN_PEAK[5]        ;
	int32_t C_TDN_PEAK_6         = ncuparam->NCU_C_TDN_PEAK[6]        ;
	int32_t C_TDN_PEAK_7         = ncuparam->NCU_C_TDN_PEAK[7]        ;
	int32_t C_TDN_PEAK_8         = ncuparam->NCU_C_TDN_PEAK[8]        ;

	int32_t C_TDN_STREN_L_0      = ncuparam->NCU_C_TDN_STREN_L[0]     ;
	int32_t C_TDN_STREN_L_1      = ncuparam->NCU_C_TDN_STREN_L[1]     ;
	int32_t C_TDN_STREN_L_2      = ncuparam->NCU_C_TDN_STREN_L[2]     ;
	int32_t C_TDN_STREN_L_3      = ncuparam->NCU_C_TDN_STREN_L[3]     ;
	int32_t C_TDN_STREN_L_4      = ncuparam->NCU_C_TDN_STREN_L[4]     ;
	int32_t C_TDN_STREN_L_5      = ncuparam->NCU_C_TDN_STREN_L[5]     ;
	int32_t C_TDN_STREN_L_6      = ncuparam->NCU_C_TDN_STREN_L[6]     ;
	int32_t C_TDN_STREN_L_7      = ncuparam->NCU_C_TDN_STREN_L[7]     ;
	int32_t C_TDN_STREN_L_8      = ncuparam->NCU_C_TDN_STREN_L[8]     ;

	int32_t C_TDN_THRES_0        = ncuparam->NCU_C_TDN_THRES[0]       ;
	int32_t C_TDN_THRES_1        = ncuparam->NCU_C_TDN_THRES[1]       ;
	int32_t C_TDN_THRES_2        = ncuparam->NCU_C_TDN_THRES[2]       ;
	int32_t C_TDN_THRES_3        = ncuparam->NCU_C_TDN_THRES[3]       ;
	int32_t C_TDN_THRES_4        = ncuparam->NCU_C_TDN_THRES[4]       ;
	int32_t C_TDN_THRES_5        = ncuparam->NCU_C_TDN_THRES[5]       ;
	int32_t C_TDN_THRES_6        = ncuparam->NCU_C_TDN_THRES[6]       ;
	int32_t C_TDN_THRES_7        = ncuparam->NCU_C_TDN_THRES[7]       ;
	int32_t C_TDN_THRES_8        = ncuparam->NCU_C_TDN_THRES[8]       ;

	int32_t C_TDN_STREN_H_0      = ncuparam->NCU_C_TDN_STREN_H[0]     ;
	int32_t C_TDN_STREN_H_1      = ncuparam->NCU_C_TDN_STREN_H[1]     ;
	int32_t C_TDN_STREN_H_2      = ncuparam->NCU_C_TDN_STREN_H[2]     ;
	int32_t C_TDN_STREN_H_3      = ncuparam->NCU_C_TDN_STREN_H[3]     ;
	int32_t C_TDN_STREN_H_4      = ncuparam->NCU_C_TDN_STREN_H[4]     ;
	int32_t C_TDN_STREN_H_5      = ncuparam->NCU_C_TDN_STREN_H[5]     ;
	int32_t C_TDN_STREN_H_6      = ncuparam->NCU_C_TDN_STREN_H[6]     ;
	int32_t C_TDN_STREN_H_7      = ncuparam->NCU_C_TDN_STREN_H[7]     ;
	int32_t C_TDN_STREN_H_8      = ncuparam->NCU_C_TDN_STREN_H[8]     ;

	int32_t C_TDN_SBASE_0        = ncuparam->NCU_C_TDN_SBASE[0]       ;
	int32_t C_TDN_SBASE_1        = ncuparam->NCU_C_TDN_SBASE[1]       ;
	int32_t C_TDN_SBASE_2        = ncuparam->NCU_C_TDN_SBASE[2]       ;
	int32_t C_TDN_SBASE_3        = ncuparam->NCU_C_TDN_SBASE[3]       ;
	int32_t C_TDN_SBASE_4        = ncuparam->NCU_C_TDN_SBASE[4]       ;
	int32_t C_TDN_SBASE_5        = ncuparam->NCU_C_TDN_SBASE[5]       ;
	int32_t C_TDN_SBASE_6        = ncuparam->NCU_C_TDN_SBASE[6]       ;
	int32_t C_TDN_SBASE_7        = ncuparam->NCU_C_TDN_SBASE[7]       ;
	int32_t C_TDN_SBASE_8        = ncuparam->NCU_C_TDN_SBASE[8]       ;

	int32_t C_TDN_SBASE ;
	C_TDN_SBASE = ncu_func_linear_insert(C_TDN_SBASE_0,C_TDN_SBASE_1,C_TDN_SBASE_2,
					     C_TDN_SBASE_3,C_TDN_SBASE_4,C_TDN_SBASE_5,
					     C_TDN_SBASE_6,C_TDN_SBASE_7,C_TDN_SBASE_8,
					     GAIN0          ,GAIN1          ,GAIN2          ,
					     GAIN3          ,GAIN4          ,GAIN5          ,
					     GAIN6          ,GAIN7          ,GAIN8          ,
					     gain);

	int32_t C_TDN_THRES;
	C_TDN_THRES = ncu_func_linear_insert(C_TDN_THRES_0,C_TDN_THRES_1,C_TDN_THRES_2,
					     C_TDN_THRES_3,C_TDN_THRES_4,C_TDN_THRES_5,
					     C_TDN_THRES_6,C_TDN_THRES_7,C_TDN_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_TDN_PEAK;
	C_TDN_PEAK = ncu_func_linear_insert(C_TDN_PEAK_0,C_TDN_PEAK_1,C_TDN_PEAK_2,
					    C_TDN_PEAK_3,C_TDN_PEAK_4,C_TDN_PEAK_5,
					    C_TDN_PEAK_6,C_TDN_PEAK_7,C_TDN_PEAK_8,
					    GAIN0       ,GAIN1       ,GAIN2       ,
					    GAIN3       ,GAIN4       ,GAIN5       ,
					    GAIN6       ,GAIN7       ,GAIN8       ,
					    gain);

	int32_t C_TDN_STREN_L ;
	C_TDN_STREN_L = ncu_func_linear_insert(C_TDN_STREN_L_0,C_TDN_STREN_L_1,C_TDN_STREN_L_2,
					       C_TDN_STREN_L_3,C_TDN_STREN_L_4,C_TDN_STREN_L_5,
					       C_TDN_STREN_L_6,C_TDN_STREN_L_7,C_TDN_STREN_L_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t C_TDN_STREN_H ;
	C_TDN_STREN_H = ncu_func_linear_insert(C_TDN_STREN_H_0,C_TDN_STREN_H_1,C_TDN_STREN_H_2,
					       C_TDN_STREN_H_3,C_TDN_STREN_H_4,C_TDN_STREN_H_5,
					       C_TDN_STREN_H_6,C_TDN_STREN_H_7,C_TDN_STREN_H_8,
					       GAIN0          ,GAIN1          ,GAIN2          ,
					       GAIN3          ,GAIN4          ,GAIN5          ,
					       GAIN6          ,GAIN7          ,GAIN8          ,
					       gain);

	int32_t C_SDN_THRES_0        = ncuparam->NCU_C_SDN_THRES[0]       ;
	int32_t C_SDN_THRES_1        = ncuparam->NCU_C_SDN_THRES[1]       ;
	int32_t C_SDN_THRES_2        = ncuparam->NCU_C_SDN_THRES[2]       ;
	int32_t C_SDN_THRES_3        = ncuparam->NCU_C_SDN_THRES[3]       ;
	int32_t C_SDN_THRES_4        = ncuparam->NCU_C_SDN_THRES[4]       ;
	int32_t C_SDN_THRES_5        = ncuparam->NCU_C_SDN_THRES[5]       ;
	int32_t C_SDN_THRES_6        = ncuparam->NCU_C_SDN_THRES[6]       ;
	int32_t C_SDN_THRES_7        = ncuparam->NCU_C_SDN_THRES[7]       ;
	int32_t C_SDN_THRES_8        = ncuparam->NCU_C_SDN_THRES[8]       ;
	int32_t C_SDN_STREN_0        = ncuparam->NCU_C_SDN_STREN[0]       ;
	int32_t C_SDN_STREN_1        = ncuparam->NCU_C_SDN_STREN[1]       ;
	int32_t C_SDN_STREN_2        = ncuparam->NCU_C_SDN_STREN[2]       ;
	int32_t C_SDN_STREN_3        = ncuparam->NCU_C_SDN_STREN[3]       ;
	int32_t C_SDN_STREN_4        = ncuparam->NCU_C_SDN_STREN[4]       ;
	int32_t C_SDN_STREN_5        = ncuparam->NCU_C_SDN_STREN[5]       ;
	int32_t C_SDN_STREN_6        = ncuparam->NCU_C_SDN_STREN[6]       ;
	int32_t C_SDN_STREN_7        = ncuparam->NCU_C_SDN_STREN[7]       ;
	int32_t C_SDN_STREN_8        = ncuparam->NCU_C_SDN_STREN[8]       ;

	int32_t C_SDN_THRES;
	C_SDN_THRES = ncu_func_linear_insert(C_SDN_THRES_0,C_SDN_THRES_1,C_SDN_THRES_2,
					     C_SDN_THRES_3,C_SDN_THRES_4,C_SDN_THRES_5,
					     C_SDN_THRES_6,C_SDN_THRES_7,C_SDN_THRES_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t C_SDN_STREN;
	C_SDN_STREN = ncu_func_linear_insert(C_SDN_STREN_0,C_SDN_STREN_1,C_SDN_STREN_2,
					     C_SDN_STREN_3,C_SDN_STREN_4,C_SDN_STREN_5,
					     C_SDN_STREN_6,C_SDN_STREN_7,C_SDN_STREN_8,
					     GAIN0        ,GAIN1        ,GAIN2        ,
					     GAIN3        ,GAIN4        ,GAIN5        ,
					     GAIN6        ,GAIN7        ,GAIN8        ,
					     gain);

	int32_t y_fs_ave_win_opt                  ; //2 bits (0~3  )
	int32_t y_fs_sgm_corr_ad_x0               ; //8 bits (0~255)
	int32_t y_fs_sgm_corr_ad_x1               ; //8 bits (0~255)
	int32_t y_fs_sgm_corr_ad_x2               ; //8 bits (0~255)
	int32_t y_fs_sgm_corr_ad_x3               ; //8 bits (0~255)
	int32_t y_fs_sgm_corr_ad_y0               ; //5 bits (0~31 )
	int32_t y_fs_sgm_corr_ad_y1               ; //5 bits (0~31 )
	int32_t y_fs_sgm_corr_ad_y2               ; //5 bits (0~31 )
	int32_t y_fs_sgm_corr_ad_s1               ; //7 bits (4+3  )
	int32_t y_fs_sgm_corr_ad_s2               ; //7 bits (4+3  )
	int32_t y_fs_sgm_corr_ad_s3               ; //7 bits (4+3  )
	int32_t y_fs_sgm_edge_ad_x0               ; //8 bits (0~255)
	int32_t y_fs_sgm_edge_ad_x1               ; //8 bits (0~255)
	int32_t y_fs_sgm_edge_ad_x2               ; //8 bits (0~255)
	int32_t y_fs_sgm_edge_ad_x3               ; //8 bits (0~255)
	int32_t y_fs_sgm_edge_ad_y0               ; //4 bits (0~8  )
	int32_t y_fs_sgm_edge_ad_y1               ; //4 bits (0~8  )
	int32_t y_fs_sgm_edge_ad_y2               ; //4 bits (0~8  )
	int32_t y_fs_sgm_edge_ad_s1               ; //5 bits (2+3  )
	int32_t y_fs_sgm_edge_ad_s2               ; //5 bits (2+3  )
	int32_t y_fs_sgm_edge_ad_s3               ; //5 bits (2+3  )
	int32_t y_fs_pxl_diff_thres               ; //8 bits (0~255)
	int32_t y_fs_pxl_fluct_thres              ; //8 bits (0~255)
	int32_t y_fs_pxl_limit                    ; //1 bits (0~1  )
	int32_t y_fs_edge_type                    ; //1 bits (0~1  )
	int32_t y_fs_edge_scope                   ; //1 bits (0~1  )
	int32_t y_fs_edge_value_thres             ; //8 bits (0~255)
	int32_t y_fs_edge_huge_thres              ; //8 bits (0~255)
	int32_t y_fs_edge_diff_slope              ; //2 bits (0~3  )
	int32_t y_fs_edge_diff_thres_low          ; //8 bits (0~255)
	int32_t y_fs_edge_diff_thres_high         ; //8 bits (0~255)
	int32_t y_fs_fluct_hg_br_diff_thres       ; //8 bits (0~255)
	int32_t y_fs_fluct_hg_br_diff_slope       ; //2 bits (0~3  )
	int32_t y_fs_fluct_hg_dk_diff_thres       ; //8 bits (0~255)
	int32_t y_fs_fluct_hg_dk_diff_slope       ; //2 bits (0~3  )
	int32_t y_fs_fluct_uhg_br_diff_thres_low  ; //8 bits (0~255)
	int32_t y_fs_fluct_uhg_br_diff_thres_high ; //8 bits (0~255)
	int32_t y_fs_fluct_uhg_br_diff_slope      ; //2 bits (0~3  )
	int32_t y_fs_fluct_uhg_dk_diff_thres_low  ; //8 bits (0~255)
	int32_t y_fs_fluct_uhg_dk_diff_thres_high ; //8 bits (0~255)
	int32_t y_fs_fluct_uhg_dk_diff_slope      ; //2 bits (0~3  )
	int32_t y_se_ref_image_sel                ; //1 bits (0~1  )
	int32_t y_se_ref_pixel_filter             ; //1 bits (0~1  )
	int32_t y_se_ref_wei_motion_opt           ; //3 bits (0~4  )
	int32_t y_se_ref_wei_pseudo_still         ; //9 bits (0~256)
	int32_t y_se_blur_win_opt                 ; //2 bits (0~3  )
	int32_t y_se_blur_wei_opt                 ; //4 bits (0~8  )
	int32_t y_se_line_diff_type               ; //1 bits (0~1  )
	int32_t y_se_line_diff_thres              ; //8 bits (0~255)
	int32_t y_se_pxl_diff_thres               ; //8 bits (0~255)
	int32_t y_se_win5_statis_diff_thres       ; //8 bits (0~255)
	int32_t y_se_win5_statis_num_thres        ; //7 bits (0~127)
	int32_t y_se_corner_length                ; //10 bits (0~1023)
	int32_t y_se_corner_case_bdv_adj          ; //6 bits (0~63)
	int32_t y_se_corner_sta_thres_adj         ; //6 bits (0~63)
	int32_t y_se_sgm_bdv_x0                   ; //9 bits (0~511)
	int32_t y_se_sgm_bdv_x1                   ; //9 bits (0~511)
	int32_t y_se_sgm_bdv_x2                   ; //9 bits (0~511)
	int32_t y_se_sgm_bdv_x3                   ; //9 bits (0~511)
	int32_t y_se_sgm_bdv_x4                   ; //9 bits (0~511)
	int32_t y_se_sgm_bdv_y0                   ; //9 bits (0~256)
	int32_t y_se_sgm_bdv_y1                   ; //9 bits (0~256)
	int32_t y_se_sgm_bdv_y2                   ; //9 bits (0~256)
	int32_t y_se_sgm_bdv_y3                   ; //9 bits (0~256)
	int32_t y_se_sgm_bdv_s1                   ; //10 bits (7+3)
	int32_t y_se_sgm_bdv_s2                   ; //10 bits (7+3)
	int32_t y_se_sgm_bdv_s3                   ; //10 bits (7+3)
	int32_t y_se_sgm_bdv_s4                   ; //10 bits (7+3)
	int32_t y_se_bdv_adj_1                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_2                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_3                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_4                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_5                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_6                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_7                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_8                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_9                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_a                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_b                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_c                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_d                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_e                    ; //6 bits (0~63 )
	int32_t y_se_bdv_adj_f                    ; //6 bits (0~63 )
	int32_t y_fusion_blur_win_opt             ; //2 bits (0~3  )
	int32_t y_fusion_mv_judge_thres           ; //9 bits (0~256)
	int32_t y_fusion_s_blur_wei               ; //9 bits (0~256)
	int32_t y_fusion_m_blur_wei               ; //9 bits (0~256)
	int32_t y_fusion_s_sgm_edge_x0            ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_edge_x1            ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_edge_x2            ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_edge_x3            ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_edge_y0            ; //9 bits (0~256)
	int32_t y_fusion_s_sgm_edge_y1            ; //9 bits (0~256)
	int32_t y_fusion_s_sgm_edge_y2            ; //9 bits (0~256)
	int32_t y_fusion_s_sgm_edge_s1            ; //10 bits (7+3)
	int32_t y_fusion_s_sgm_edge_s2            ; //10 bits (7+3)
	int32_t y_fusion_s_sgm_edge_s3            ; //10 bits (7+3)
	int32_t y_fusion_s_sgm_pfr_x0             ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_pfr_x1             ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_pfr_x2             ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_pfr_x3             ; //8 bits (0~255)
	int32_t y_fusion_s_sgm_pfr_y0             ; //9 bits (0~256)
	int32_t y_fusion_s_sgm_pfr_y1             ; //9 bits (0~256)
	int32_t y_fusion_s_sgm_pfr_y2             ; //9 bits (0~256)
	int32_t y_fusion_s_sgm_pfr_s1             ; //10 bits (7+3)
	int32_t y_fusion_s_sgm_pfr_s2             ; //10 bits (7+3)
	int32_t y_fusion_s_sgm_pfr_s3             ; //10 bits (7+3)
	int32_t y_fusion_s_org_br_supres_thres    ; //8 bits (0~255)
	int32_t y_fusion_s_org_br_supres_slope    ; //3 bits (0~7  )
	int32_t y_fusion_s_org_dk_supres_thres    ; //8 bits (0~255)
	int32_t y_fusion_s_org_dk_supres_slope    ; //3 bits (0~7  )
	int32_t y_fusion_m_sgm_edge_x0            ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_edge_x1            ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_edge_x2            ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_edge_x3            ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_edge_y0            ; //9 bits (0~256)
	int32_t y_fusion_m_sgm_edge_y1            ; //9 bits (0~256)
	int32_t y_fusion_m_sgm_edge_y2            ; //9 bits (0~256)
	int32_t y_fusion_m_sgm_edge_s1            ; //10 bits (7+3)
	int32_t y_fusion_m_sgm_edge_s2            ; //10 bits (7+3)
	int32_t y_fusion_m_sgm_edge_s3            ; //10 bits (7+3)
	int32_t y_fusion_m_sgm_pfr_x0             ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_pfr_x1             ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_pfr_x2             ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_pfr_x3             ; //8 bits (0~255)
	int32_t y_fusion_m_sgm_pfr_y0             ; //9 bits (0~256)
	int32_t y_fusion_m_sgm_pfr_y1             ; //9 bits (0~256)
	int32_t y_fusion_m_sgm_pfr_y2             ; //9 bits (0~256)
	int32_t y_fusion_m_sgm_pfr_s1             ; //10 bits (7+3)
	int32_t y_fusion_m_sgm_pfr_s2             ; //10 bits (7+3)
	int32_t y_fusion_m_sgm_pfr_s3             ; //10 bits (7+3)
	int32_t y_fusion_m_org_br_supres_thres    ; //8 bits (0~255)
	int32_t y_fusion_m_org_br_supres_slope    ; //3 bits (0~7  )
	int32_t y_fusion_m_org_dk_supres_thres    ; //8 bits (0~255)
	int32_t y_fusion_m_org_dk_supres_slope    ; //3 bits (0~7  )
	int32_t y_psn_max_num                     ; //5 bits (0~31 )
	int32_t y_psn_incr_type                   ; //1 bits (0~1  )
	int32_t y_psn_share_sta_adj               ; //1 bits (0~1  )
	int32_t y_psn_wei_step                    ; //8 bits (0~255)
	int32_t y_psn_wei_limit                   ; //9 bits (0~256)
	int32_t y_psn_max_num_wei                 ; //9 bits (0~256)
	int32_t y_psn_start_wei                   ; //9 bits (0~256)
	int32_t y_sta_blk_size_w                  ; //11 bits (0~2592/2)
	int32_t y_sta_blk_size_h                  ; //11 bits (0~2048/2)
	int32_t y_sta_blur_win_opt                ; //2 bits (0~3  )
	int32_t y_sta_blur_wei_opt                ; //4 bits (0~8  )
	int32_t y_sta_mv_blk_bdv_x0_adj           ; //9 bits (0~511)
	int32_t y_sta_mv_blk_pdt_adj              ; //8 bits (0~255)
	int32_t y_sta_diff_thres_val              ; //9 bits (0~511)
	int32_t y_sta_diff_thres_val_glb          ; //9 bits (0~511)
	int32_t y_sta_mv_num_thres                ; //21 bits (0~(2^21-1))
	int32_t y_br_area_thres                   ; //8 bits (0~255)
	int32_t y_br_area_bdv_adj_dir             ; //1 bits (0~1  )
	int32_t y_br_area_bdv_adj_value           ; //6 bits (0~63 )
	int32_t y_dk_area_thres                   ; //8 bits (0~255)
	int32_t y_dk_area_bdv_adj_dir             ; //1 bits (0~1  )
	int32_t y_dk_area_bdv_adj_value           ; //6 bits (0~63 )
	int32_t y_bi_sgm_p_x0                     ; //8 bits (1~255)
	int32_t y_bi_sgm_p_x1                     ; //8 bits (1~255)
	int32_t y_bi_sgm_p_x2                     ; //8 bits (1~255)
	int32_t y_bi_sgm_p_x3                     ; //8 bits (1~255)
	int32_t y_bi_sgm_p_y0                     ; //5 bits (1~16 )
	int32_t y_bi_sgm_p_y1                     ; //5 bits (1~16 )
	int32_t y_bi_sgm_p_y2                     ; //5 bits (1~16 )
	int32_t y_bi_sgm_p_y3                     ; //5 bits (1~16 )
	int32_t y_bi_sgm_p_s0                     ; //6 bits (3+3  )
	int32_t y_bi_sgm_p_s1                     ; //6 bits (3+3  )
	int32_t y_bi_sgm_p_s2                     ; //6 bits (3+3  )
	int32_t y_bi_sgm_p_s3                     ; //6 bits (3+3  )
	int32_t y_bi_sgm_g_0                      ; //2 bits (0~3  )
	int32_t y_bi_sgm_g_1                      ; //2 bits (0~3  )
	int32_t y_bi_sgm_g_2                      ; //2 bits (0~3  )
	int32_t y_bi_sgm_g_3                      ; //2 bits (0~3  )
	int32_t y_bi_sgm_g_4                      ; //2 bits (0~3  )

	int32_t uv_fs_sgm_corr_ad_x0              ; //8 bits (0~255)
	int32_t uv_fs_sgm_corr_ad_x1              ; //8 bits (0~255)
	int32_t uv_fs_sgm_corr_ad_x2              ; //8 bits (0~255)
	int32_t uv_fs_sgm_corr_ad_y0              ; //5 bits (0~31 )
	int32_t uv_fs_sgm_corr_ad_y1              ; //5 bits (0~31 )
	int32_t uv_fs_sgm_corr_ad_s1              ; //6 bits (4+2  )
	int32_t uv_fs_sgm_corr_ad_s2              ; //6 bits (4+2  )
	int32_t uv_fs_sgm_edge_ad_x0              ; //8 bits (0~255)
	int32_t uv_fs_sgm_edge_ad_x1              ; //8 bits (0~255)
	int32_t uv_fs_sgm_edge_ad_x2              ; //8 bits (0~255)
	int32_t uv_fs_sgm_edge_ad_y0              ; //4 bits (0~8  )
	int32_t uv_fs_sgm_edge_ad_y1              ; //4 bits (0~8  )
	int32_t uv_fs_sgm_edge_ad_s1              ; //4 bits (2+2  )
	int32_t uv_fs_sgm_edge_ad_s2              ; //4 bits (2+2  )
	int32_t uv_fs_pxl_diff_thres              ; //8 bits (0~255)
	int32_t uv_fs_pxl_fluct_thres             ; //8 bits (0~255)
	int32_t uv_fs_pxl_limit                   ; //1 bits (0~1  )
	int32_t uv_fs_edge_type                   ; //1 bits (0~1  )
	int32_t uv_fs_edge_value_thres            ; //8 bits (0~255)
	int32_t uv_fs_edge_huge_thres             ; //8 bits (0~255)
	int32_t uv_fs_edge_diff_slope             ; //2 bits (0~3  )
	int32_t uv_fs_edge_diff_thres_low         ; //8 bits (0~255)
	int32_t uv_fs_edge_diff_thres_high        ; //8 bits (0~255)
	int32_t uv_fs_fluct_hg_br_diff_thres      ; //8 bits (0~255)
	int32_t uv_fs_fluct_hg_br_diff_slope      ; //2 bits (0~3  )
	int32_t uv_fs_fluct_hg_dk_diff_thres      ; //8 bits (0~255)
	int32_t uv_fs_fluct_hg_dk_diff_slope      ; //2 bits (0~3  )
	int32_t uv_fs_fluct_uhg_br_diff_thres_low ; //8 bits (0~255)
	int32_t uv_fs_fluct_uhg_br_diff_thres_high; //8 bits (0~255)
	int32_t uv_fs_fluct_uhg_br_diff_slope     ; //2 bits (0~3  )
	int32_t uv_fs_fluct_uhg_dk_diff_thres_low ; //8 bits (0~255)
	int32_t uv_fs_fluct_uhg_dk_diff_thres_high; //8 bits (0~255)
	int32_t uv_fs_fluct_uhg_dk_diff_slope     ; //2 bits (0~3  )
	int32_t uv_se_ref_pixel_filter            ; //1 bits (0~1  )
	int32_t uv_se_ref_wei_motion_opt          ; //3 bits (0~4  )
	int32_t uv_se_ref_wei_pseudo_still        ; //9 bits (0~256)
	int32_t uv_se_blur_wei_opt                ; //4 bits (0~8  )
	int32_t uv_se_line_diff_type              ; //1 bits (0~1  )
	int32_t uv_se_pxl_diff_thres              ; //8 bits (0~255)
	int32_t uv_se_line_diff_thres             ; //8 bits (0~255)
	int32_t uv_se_corner_length               ; //10 bits (0~1023)
	int32_t uv_se_corner_case_bdv_adj         ; //6 bits (0~63)
	int32_t uv_se_corner_sta_thres_adj        ; //6 bits (0~63)
	int32_t uv_se_sgm_bdv_x0                  ; //9 bits (0~511)
	int32_t uv_se_sgm_bdv_x1                  ; //9 bits (0~511)
	int32_t uv_se_sgm_bdv_x2                  ; //9 bits (0~511)
	int32_t uv_se_sgm_bdv_x3                  ; //9 bits (0~511)
	int32_t uv_se_sgm_bdv_y0                  ; //9 bits (0~256)
	int32_t uv_se_sgm_bdv_y1                  ; //9 bits (0~256)
	int32_t uv_se_sgm_bdv_y2                  ; //9 bits (0~256)
	int32_t uv_se_sgm_bdv_s1                  ; //9 bits (7+2  )
	int32_t uv_se_sgm_bdv_s2                  ; //9 bits (7+2  )
	int32_t uv_se_sgm_bdv_s3                  ; //9 bits (7+2  )
	int32_t uv_se_bdv_adj_1                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_2                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_3                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_4                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_5                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_6                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_7                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_8                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_9                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_a                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_b                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_c                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_d                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_e                   ; //6 bits (0~63 )
	int32_t uv_se_bdv_adj_f                   ; //6 bits (0~63 )
	int32_t uv_fusion_mv_judge_thres          ; //9 bits (0~256)
	int32_t uv_fusion_s_blur_wei              ; //9 bits (0~256)
	int32_t uv_fusion_m_blur_wei              ; //9 bits (0~256)
	int32_t uv_fusion_s_sgm_edge_x0           ; //8 bits (0~255)
	int32_t uv_fusion_s_sgm_edge_x1           ; //8 bits (0~255)
	int32_t uv_fusion_s_sgm_edge_x2           ; //8 bits (0~255)
	int32_t uv_fusion_s_sgm_edge_y0           ; //9 bits (0~256)
	int32_t uv_fusion_s_sgm_edge_y1           ; //9 bits (0~256)
	int32_t uv_fusion_s_sgm_edge_s1           ; //9 bits (7+2  )
	int32_t uv_fusion_s_sgm_edge_s2           ; //9 bits (7+2  )
	int32_t uv_fusion_s_sgm_pfr_x0            ; //8 bits (0~255)
	int32_t uv_fusion_s_sgm_pfr_x1            ; //8 bits (0~255)
	int32_t uv_fusion_s_sgm_pfr_x2            ; //8 bits (0~255)
	int32_t uv_fusion_s_sgm_pfr_y0            ; //9 bits (0~256)
	int32_t uv_fusion_s_sgm_pfr_y1            ; //9 bits (0~256)
	int32_t uv_fusion_s_sgm_pfr_s1            ; //9 bits (7+2  )
	int32_t uv_fusion_s_sgm_pfr_s2            ; //9 bits (7+2  )
	int32_t uv_fusion_s_org_br_supres_thres   ; //8 bits (0~255)
	int32_t uv_fusion_s_org_br_supres_slope   ; //3 bits (0~7  )
	int32_t uv_fusion_s_org_dk_supres_thres   ; //8 bits (0~255)
	int32_t uv_fusion_s_org_dk_supres_slope   ; //3 bits (0~7  )
	int32_t uv_fusion_m_sgm_edge_x0           ; //8 bits (0~255)
	int32_t uv_fusion_m_sgm_edge_x1           ; //8 bits (0~255)
	int32_t uv_fusion_m_sgm_edge_x2           ; //8 bits (0~255)
	int32_t uv_fusion_m_sgm_edge_y0           ; //9 bits (0~256)
	int32_t uv_fusion_m_sgm_edge_y1           ; //9 bits (0~256)
	int32_t uv_fusion_m_sgm_edge_s1           ; //9 bits (7+2  )
	int32_t uv_fusion_m_sgm_edge_s2           ; //9 bits (7+2  )
	int32_t uv_fusion_m_sgm_pfr_x0            ; //8 bits (0~255)
	int32_t uv_fusion_m_sgm_pfr_x1            ; //8 bits (0~255)
	int32_t uv_fusion_m_sgm_pfr_x2            ; //8 bits (0~255)
	int32_t uv_fusion_m_sgm_pfr_y0            ; //9 bits (0~256)
	int32_t uv_fusion_m_sgm_pfr_y1            ; //9 bits (0~256)
	int32_t uv_fusion_m_sgm_pfr_s1            ; //9 bits (7+2  )
	int32_t uv_fusion_m_sgm_pfr_s2            ; //9 bits (7+2  )
	int32_t uv_fusion_m_org_br_supres_thres   ; //8 bits (0~255)
	int32_t uv_fusion_m_org_br_supres_slope   ; //3 bits (0~7  )
	int32_t uv_fusion_m_org_dk_supres_thres   ; //8 bits (0~255)
	int32_t uv_fusion_m_org_dk_supres_slope   ; //3 bits (0~7  )
	int32_t uv_psn_max_num                    ; //5 bits (0~31 )
	int32_t uv_psn_incr_type                  ; //1 bits (0~1  )
	int32_t uv_psn_share_sta_adj              ; //1 bits (0~1  )
	int32_t uv_psn_wei_step                   ; //8 bits (0~255)
	int32_t uv_psn_wei_limit                  ; //9 bits (0~256)
	int32_t uv_psn_max_num_wei                ; //9 bits (0~256)
	int32_t uv_psn_start_wei                  ; //9 bits (0~256)
	int32_t uv_sta_blk_size_w                 ; //10 bits (0~2592/4)
	int32_t uv_sta_blk_size_h                 ; //10 bits (0~2048/4)
	int32_t uv_sta_blur_wei_opt               ; //4 bits (0~8  )
	int32_t uv_sta_mv_blk_bdv_x0_adj          ; //9 bits (0~511)
	int32_t uv_sta_mv_blk_pdt_adj             ; //8 bits (0~255)
	int32_t uv_sta_diff_thres_val             ; //9 bits (0~511)
	int32_t uv_sta_diff_thres_val_glb         ; //9 bits (0~511)
	int32_t uv_sta_mv_num_thres               ; //21 bits (0~(2^21-1))
	int32_t uv_false_color_style              ; //1 bits (0~1  )
	int32_t uv_false_color_slope              ; //2 bits (0~3  )
	int32_t uv_false_color_base               ; //8 bits (0~255)
	int32_t uv_false_color_thres              ; //8 bits (0~255)

	y_fs_ave_win_opt                  = 3                          ;
	y_fs_sgm_corr_ad_x0               = 20                         ;
	y_fs_sgm_corr_ad_x1               = 100                        ;
	y_fs_sgm_corr_ad_x2               = 150                        ;
	y_fs_sgm_corr_ad_x3               = 240                        ;
	y_fs_sgm_corr_ad_y0               = 16                         ;
	y_fs_sgm_corr_ad_y1               = 16                         ;
	y_fs_sgm_corr_ad_y2               = 16                         ;
	y_fs_sgm_edge_ad_x0               = 20                         ;
	y_fs_sgm_edge_ad_x1               = 100                        ;
	y_fs_sgm_edge_ad_x2               = 150                        ;
	y_fs_sgm_edge_ad_x3               = 250                        ;
	y_fs_sgm_edge_ad_y0               = 8                          ;
	y_fs_sgm_edge_ad_y1               = 8                          ;
	y_fs_sgm_edge_ad_y2               = 8                          ;
	y_fs_pxl_diff_thres               = 10                         ;
	y_fs_pxl_fluct_thres              = 10                         ;
	y_fs_pxl_limit                    = 1                          ;
	y_fs_edge_type                    = L_EDG_TYPE                 ;
	y_fs_edge_scope                   = 0                          ;
	y_fs_edge_value_thres             = 10                         ;
	y_fs_edge_huge_thres              = 245                        ;
	y_fs_edge_diff_slope              = L_EDG_DIFF_SLOPE           ;
	y_fs_edge_diff_thres_low          = L_EDG_DIFF_LOW             ;
	y_fs_edge_diff_thres_high         = L_EDG_DIFF_HIGH            ;
	y_fs_fluct_hg_br_diff_thres       = 180                        ;
	y_fs_fluct_hg_br_diff_slope       = 3                          ;
	y_fs_fluct_hg_dk_diff_thres       = 180                        ;
	y_fs_fluct_hg_dk_diff_slope       = 3                          ;
	y_fs_fluct_uhg_br_diff_thres_low  = 50                         ;
	y_fs_fluct_uhg_br_diff_thres_high = 200                        ;
	y_fs_fluct_uhg_br_diff_slope      = 0                          ;
	y_fs_fluct_uhg_dk_diff_thres_low  = 50                         ;
	y_fs_fluct_uhg_dk_diff_thres_high = 200                        ;
	y_fs_fluct_uhg_dk_diff_slope      = 0                          ;
	y_se_ref_image_sel                = L_TDN_RISEL                ;
	y_se_ref_pixel_filter             = L_TDN_EN                   ;
	y_se_ref_wei_motion_opt           = 0                          ;
	y_se_ref_wei_pseudo_still         = 100                        ;
	y_se_blur_win_opt                 = L_TDN_LEVEL/9              ;
	y_se_blur_wei_opt                 = 8-(L_TDN_LEVEL%9)          ;
	y_se_line_diff_type               = 0                          ;
	y_se_line_diff_thres              = 255                        ;
	y_se_pxl_diff_thres               = 255                        ;
	y_se_win5_statis_diff_thres       = 20                         ;
	y_se_win5_statis_num_thres        = 150                        ;
	y_se_corner_length                = L_CNA_THRES                ;
	y_se_corner_case_bdv_adj          = L_CNA_STREN                ;
	y_se_corner_sta_thres_adj         = L_CNA_STREN                ;

	if (L_TDN_PEAK < 5 )
		L_TDN_PEAK = 5;
	if (L_TDN_PEAK > 95)
		L_TDN_PEAK = 95;

	if (L_LCK_EN == 0){
		if (L_TDN_SBASE < 10){
			y_se_sgm_bdv_x0                   = L_TDN_THRES                ;
			y_se_sgm_bdv_x1                   = L_TDN_THRES+ 5             ;
			y_se_sgm_bdv_x2                   = L_TDN_THRES+10             ;
			y_se_sgm_bdv_x3                   = 500                        ;
			y_se_sgm_bdv_x4                   = 510                        ;
			y_se_sgm_bdv_y0                   = L_TDN_STREN_H              ;
			y_se_sgm_bdv_y1                   = L_TDN_STREN_L + (((L_TDN_STREN_H-L_TDN_STREN_L)*L_TDN_PEAK)/100);
			y_se_sgm_bdv_y2                   = L_TDN_STREN_L              ;
			y_se_sgm_bdv_y3                   = L_TDN_STREN_L              ;
		} else {
			y_se_sgm_bdv_x0                   = L_TDN_THRES                ;
			y_se_sgm_bdv_x1                   = L_TDN_THRES+ 5             ;
			y_se_sgm_bdv_x2                   = L_TDN_THRES+10             ;
			y_se_sgm_bdv_x3                   = 500                        ;
			y_se_sgm_bdv_x4                   = 510                        ;
			y_se_sgm_bdv_y0                   = L_TDN_SBASE                ;
			y_se_sgm_bdv_y1                   = L_TDN_STREN_H              ;
			y_se_sgm_bdv_y2                   = L_TDN_STREN_L + (((L_TDN_STREN_H-L_TDN_STREN_L)*L_TDN_PEAK)/100);
			y_se_sgm_bdv_y3                   = L_TDN_STREN_L              ;
		}
	} else {
		y_se_sgm_bdv_x0                   = 5                          ;
		y_se_sgm_bdv_x1                   = 100                        ;
		y_se_sgm_bdv_x2                   = 300                        ;
		y_se_sgm_bdv_x3                   = 500                        ;
		y_se_sgm_bdv_x4                   = 510                        ;
		y_se_sgm_bdv_y0                   = L_TDN_LMT_0                ;
		y_se_sgm_bdv_y1                   = L_TDN_LMT_0                ;
		y_se_sgm_bdv_y2                   = L_TDN_LMT_0                ;
		y_se_sgm_bdv_y3                   = L_TDN_LMT_0                ;
	}

	y_se_bdv_adj_1                    = L_TDN_BDV_ADJ_1            ;
	y_se_bdv_adj_2                    = L_TDN_BDV_ADJ_2            ;
	y_se_bdv_adj_3                    = L_TDN_BDV_ADJ_3            ;
	y_se_bdv_adj_4                    = L_TDN_BDV_ADJ_4            ;
	y_se_bdv_adj_5                    = L_TDN_BDV_ADJ_5            ;
	y_se_bdv_adj_6                    = 0                          ;
	y_se_bdv_adj_7                    = 0                          ;
	y_se_bdv_adj_8                    = 0                          ;
	y_se_bdv_adj_9                    = 0                          ;
	y_se_bdv_adj_a                    = 0                          ;
	y_se_bdv_adj_b                    = 0                          ;
	y_se_bdv_adj_c                    = 0                          ;
	y_se_bdv_adj_d                    = 0                          ;
	y_se_bdv_adj_e                    = 0                          ;
	y_se_bdv_adj_f                    = 0                          ;

	y_fusion_blur_win_opt             = L_BTA_STREN                ;
	y_fusion_mv_judge_thres           = L_SMJ_THRES                ;
	y_fusion_s_blur_wei               = L_BSA_STREN                ;
	y_fusion_m_blur_wei               = L_BMA_STREN                ;

	if (L_ESA_PEAK < 5 )
		L_ESA_PEAK = 5;
	if (L_ESA_PEAK > 95)
		L_ESA_PEAK = 95;

	if (L_ESA_THRES < 100)
		L_ESA_THRES = 100;

	y_fusion_s_sgm_edge_x0             = L_ESA_THRES                ;
	y_fusion_s_sgm_edge_x1             = L_ESA_THRES - (((L_ESA_THRES-20)*L_ESA_PEAK)/100);
	y_fusion_s_sgm_edge_x2             = 20                         ;
	y_fusion_s_sgm_edge_x3             = 10                         ;
	y_fusion_s_sgm_edge_y0             = L_ESA_STREN_H              ;
	y_fusion_s_sgm_edge_y1             = L_ESA_STREN_H-(((L_ESA_STREN_H-L_ESA_STREN_L)*L_ESA_PEAK)/100);
	y_fusion_s_sgm_edge_y2             = L_ESA_STREN_L              ;

	if (L_PSA_PEAK < 5 ) {L_PSA_PEAK = 5 ;}
	if (L_PSA_PEAK > 95) {L_PSA_PEAK = 95;}

	y_fusion_s_sgm_pfr_x0             = L_PSA_THRES                ;
	y_fusion_s_sgm_pfr_x1             = L_PSA_THRES + (((200-L_PSA_THRES)*L_PSA_PEAK)/100);
	y_fusion_s_sgm_pfr_x2             = 200                        ;
	y_fusion_s_sgm_pfr_x3             = 220                        ;
	y_fusion_s_sgm_pfr_y0             = L_PSA_STREN_H              ;
	y_fusion_s_sgm_pfr_y1             = L_PSA_STREN_H-(((L_PSA_STREN_H-L_PSA_STREN_L)*L_PSA_PEAK)/100);
	y_fusion_s_sgm_pfr_y2             = L_PSA_STREN_L              ;

	y_fusion_s_org_br_supres_thres    = L_OSB_THRES                ;
	y_fusion_s_org_br_supres_slope    = L_OSB_SLOPE                ;
	y_fusion_s_org_dk_supres_thres    = L_OSD_THRES                ;
	y_fusion_s_org_dk_supres_slope    = L_OSD_SLOPE                ;

	if (L_EMA_PEAK < 5 )
		L_EMA_PEAK = 5;
	if (L_EMA_PEAK > 95)
		L_EMA_PEAK = 95;
	if (L_EMA_THRES < 100)
		L_EMA_THRES = 100;

	y_fusion_m_sgm_edge_x0             = L_EMA_THRES                ;
	y_fusion_m_sgm_edge_x1             = L_EMA_THRES - (((L_EMA_THRES-20)*L_EMA_PEAK)/100);
	y_fusion_m_sgm_edge_x2             = 20                         ;
	y_fusion_m_sgm_edge_x3             = 10                         ;
	y_fusion_m_sgm_edge_y0             = L_EMA_STREN_H              ;
	y_fusion_m_sgm_edge_y1             = L_EMA_STREN_H-(((L_EMA_STREN_H-L_EMA_STREN_L)*L_EMA_PEAK)/100);
	y_fusion_m_sgm_edge_y2             = L_EMA_STREN_L              ;

	if (L_PMA_PEAK < 5 )
		L_PMA_PEAK = 5;
	if (L_PMA_PEAK > 95)
		L_PMA_PEAK = 95;

	y_fusion_m_sgm_pfr_x0             = L_PMA_THRES                ;
	y_fusion_m_sgm_pfr_x1             = L_PMA_THRES + (((200-L_PMA_THRES)*L_PMA_PEAK)/100);
	y_fusion_m_sgm_pfr_x2             = 200                        ;
	y_fusion_m_sgm_pfr_x3             = 220                        ;
	y_fusion_m_sgm_pfr_y0             = L_PMA_STREN_H              ;
	y_fusion_m_sgm_pfr_y1             = L_PMA_STREN_H-(((L_PMA_STREN_H-L_PMA_STREN_L)*L_PMA_PEAK)/100);
	y_fusion_m_sgm_pfr_y2             = L_PMA_STREN_L              ;

	y_fusion_m_org_br_supres_thres    = L_OMB_THRES                ;
	y_fusion_m_org_br_supres_slope    = L_OMB_SLOPE                ;
	y_fusion_m_org_dk_supres_thres    = L_OMD_THRES                ;
	y_fusion_m_org_dk_supres_slope    = L_OMD_SLOPE                ;

	y_psn_max_num                     = L_TDN_MAXNUM               ;

	if (L_LCK_EN == 1) {L_TDN_TYPE = 0;}

	y_psn_incr_type                   = L_TDN_TYPE                 ;
	y_psn_share_sta_adj               = 0                          ;
	y_psn_wei_step                    = L_TDN_STEP                 ;
	y_psn_wei_limit                   = L_TDN_LMT                  ;
	y_psn_max_num_wei                 = L_TDN_LMT                  ;
	y_psn_start_wei                   = 50                         ;
	y_sta_blk_size_w                  = L_TDN_WIN                  ;
	y_sta_blk_size_h                  = L_TDN_WIN                  ;
	y_sta_blur_win_opt                = y_se_blur_win_opt          ;
	y_sta_blur_wei_opt                = y_se_blur_wei_opt          ;
	y_sta_mv_blk_bdv_x0_adj           = 0                          ;
	y_sta_mv_blk_pdt_adj              = 0                          ;
	y_sta_diff_thres_val              = L_TDN_THRES                ;
	y_sta_diff_thres_val_glb          = L_TDN_THRES                ;
	y_sta_mv_num_thres                = L_TDN_NUM                  ;
	y_br_area_thres                   = L_LIB_THRES                ;

	if (L_LIB_STREN >= 50){
		y_br_area_bdv_adj_dir           = 0                          ;
		y_br_area_bdv_adj_value         = L_LIB_STREN-50             ;
	} else if (L_LIB_STREN<50){
		y_br_area_bdv_adj_dir           = 1                          ;
		y_br_area_bdv_adj_value         = 50-L_LIB_STREN             ;
	}

	y_dk_area_thres                   = L_LID_THRES                ;
	if (L_LID_STREN >= 50){
		y_dk_area_bdv_adj_dir           = 0                          ;
		y_dk_area_bdv_adj_value         = L_LID_STREN-50             ;
	} else if (L_LID_STREN < 50){
		y_dk_area_bdv_adj_dir           = 1                          ;
		y_dk_area_bdv_adj_value         = 50-L_LID_STREN             ;
	}

	y_bi_sgm_p_x0                     = 10  ;
	y_bi_sgm_p_x1                     = 20  ;
	y_bi_sgm_p_x2                     = 40  ;
	y_bi_sgm_p_x3                     = 70  ;
	y_bi_sgm_p_y0                     = 16  ;

	L_SDN_STREN_P = 16 - L_SDN_STREN_P;

	if (16 > 1*L_SDN_STREN_P){
		y_bi_sgm_p_y1                   = 16 - 1*L_SDN_STREN_P;
	} else {
		y_bi_sgm_p_y1                   = 0                   ;
	}

	if (16 > 2*L_SDN_STREN_P){
		y_bi_sgm_p_y2                   = 16 - 2*L_SDN_STREN_P;
	} else {
		y_bi_sgm_p_y2                   = 0                   ;
	}

	if (16 > 3*L_SDN_STREN_P){
		y_bi_sgm_p_y3                   = 16 - 3*L_SDN_STREN_P;
	} else {
		y_bi_sgm_p_y3                   = 0                   ;
	}

	y_bi_sgm_g_0                    = 0                          ;
	y_bi_sgm_g_1                    = 0                          ;
	y_bi_sgm_g_2                    = 0                          ;
	y_bi_sgm_g_3                    = 0                          ;
	y_bi_sgm_g_4                    = 0                          ;

	if (L_SDN_STREN_G == 3){
		y_bi_sgm_g_0                    = 0                          ;
		y_bi_sgm_g_1                    = 0                          ;
		y_bi_sgm_g_2                    = 0                          ;
		y_bi_sgm_g_3                    = 0                          ;
		y_bi_sgm_g_4                    = 0                          ;
	} else if (L_SDN_STREN_G == 2){
		y_bi_sgm_g_0                    = 0                          ;
		y_bi_sgm_g_1                    = 0                          ;
		y_bi_sgm_g_2                    = 1                          ;
		y_bi_sgm_g_3                    = 1                          ;
		y_bi_sgm_g_4                    = 2                          ;
	} else if (L_SDN_STREN_G == 1){
		y_bi_sgm_g_0                    = 0                          ;
		y_bi_sgm_g_1                    = 1                          ;
		y_bi_sgm_g_2                    = 2                          ;
		y_bi_sgm_g_3                    = 2                          ;
		y_bi_sgm_g_4                    = 3                          ;
	} else if (L_SDN_STREN_G == 0){
		y_bi_sgm_g_0                    = 1                          ;
		y_bi_sgm_g_1                    = 2                          ;
		y_bi_sgm_g_2                    = 2                          ;
		y_bi_sgm_g_3                    = 3                          ;
		y_bi_sgm_g_4                    = 3                          ;
	}

	uv_fs_sgm_corr_ad_x0              = 20                         ;
	uv_fs_sgm_corr_ad_x1              = 130                        ;
	uv_fs_sgm_corr_ad_x2              = 240                        ;
	uv_fs_sgm_corr_ad_y0              = 16                         ;
	uv_fs_sgm_corr_ad_y1              = 16                         ;
	uv_fs_sgm_edge_ad_x0              = 20                         ;
	uv_fs_sgm_edge_ad_x1              = 130                        ;
	uv_fs_sgm_edge_ad_x2              = 240                        ;
	uv_fs_sgm_edge_ad_y0              = 8                          ;
	uv_fs_sgm_edge_ad_y1              = 8                          ;
	uv_fs_pxl_diff_thres              = 10                         ;
	uv_fs_pxl_fluct_thres             = 10                         ;
	uv_fs_pxl_limit                   = 1                          ;
	uv_fs_edge_type                   = C_EDG_TYPE                 ;
	uv_fs_edge_value_thres            = 10                         ;
	uv_fs_edge_huge_thres             = 245                        ;
	uv_fs_edge_diff_slope             = C_EDG_DIFF_SLOPE           ;
	uv_fs_edge_diff_thres_low         = C_EDG_DIFF_LOW             ;
	uv_fs_edge_diff_thres_high        = C_EDG_DIFF_HIGH            ;
	uv_fs_fluct_hg_br_diff_thres      = 180                        ;
	uv_fs_fluct_hg_br_diff_slope      = 3                          ;
	uv_fs_fluct_hg_dk_diff_thres      = 180                        ;
	uv_fs_fluct_hg_dk_diff_slope      = 3                          ;
	uv_fs_fluct_uhg_br_diff_thres_low = 50                         ;
	uv_fs_fluct_uhg_br_diff_thres_high= 200                        ;
	uv_fs_fluct_uhg_br_diff_slope     = 0                          ;
	uv_fs_fluct_uhg_dk_diff_thres_low = 50                         ;
	uv_fs_fluct_uhg_dk_diff_thres_high= 200                        ;
	uv_fs_fluct_uhg_dk_diff_slope     = 0                          ;
	uv_se_ref_pixel_filter            = C_TDN_EN                   ;
	uv_se_ref_wei_motion_opt          = 0                          ;
	uv_se_ref_wei_pseudo_still        = 100                        ;
	uv_se_blur_wei_opt                = 8-C_TDN_LEVEL              ;
	uv_se_line_diff_type              = 0                          ;
	uv_se_pxl_diff_thres              = 255                        ;
	uv_se_line_diff_thres             = 255                        ;
	uv_se_corner_length               = C_CNA_THRES                ;
	uv_se_corner_case_bdv_adj         = C_CNA_STREN                ;
	uv_se_corner_sta_thres_adj        = C_CNA_STREN                ;

	if (C_TDN_PEAK < 5 )
		C_TDN_PEAK = 5;
	if (C_TDN_PEAK > 95)
		C_TDN_PEAK = 95;

	if (C_LCK_EN == 0){
		if (C_TDN_SBASE < 10){
			uv_se_sgm_bdv_x0                  = C_TDN_THRES                ;
			uv_se_sgm_bdv_x1                  = C_TDN_THRES + 5            ;
			uv_se_sgm_bdv_x2                  = 500                        ;
			uv_se_sgm_bdv_x3                  = 510                        ;
			uv_se_sgm_bdv_y0                  = C_TDN_STREN_H              ;
			uv_se_sgm_bdv_y1                  = C_TDN_STREN_L + (((C_TDN_STREN_H-C_TDN_STREN_L) * C_TDN_PEAK)/100);
			uv_se_sgm_bdv_y2                  = C_TDN_STREN_L              ;
		} else {
			uv_se_sgm_bdv_x0                  = C_TDN_THRES                ;
			uv_se_sgm_bdv_x1                  = C_TDN_THRES + 5            ;
			uv_se_sgm_bdv_x2                  = 500                        ;
			uv_se_sgm_bdv_x3                  = 510                        ;
			uv_se_sgm_bdv_y0                  = C_TDN_SBASE                ;
			uv_se_sgm_bdv_y1                  = C_TDN_STREN_H              ;
			uv_se_sgm_bdv_y2                  = C_TDN_STREN_L + (((C_TDN_STREN_H-C_TDN_STREN_L)*C_TDN_PEAK)/100);
		}
	} else{
		uv_se_sgm_bdv_x0                  = 5                          ;
		uv_se_sgm_bdv_x1                  = 300                        ;
		uv_se_sgm_bdv_x2                  = 500                        ;
		uv_se_sgm_bdv_x3                  = 510                        ;
		uv_se_sgm_bdv_y0                  = C_TDN_LMT_0                ;
		uv_se_sgm_bdv_y1                  = C_TDN_LMT_0                ;
		uv_se_sgm_bdv_y2                  = C_TDN_LMT_0                ;
	}

	uv_se_bdv_adj_1                   = C_TDN_BDV_ADJ_1            ;
	uv_se_bdv_adj_2                   = C_TDN_BDV_ADJ_2            ;
	uv_se_bdv_adj_3                   = C_TDN_BDV_ADJ_3            ;
	uv_se_bdv_adj_4                   = C_TDN_BDV_ADJ_4            ;
	uv_se_bdv_adj_5                   = C_TDN_BDV_ADJ_5            ;
	uv_se_bdv_adj_6                   = 0                          ;
	uv_se_bdv_adj_7                   = 0                          ;
	uv_se_bdv_adj_8                   = 0                          ;
	uv_se_bdv_adj_9                   = 0                          ;
	uv_se_bdv_adj_a                   = 0                          ;
	uv_se_bdv_adj_b                   = 0                          ;
	uv_se_bdv_adj_c                   = 0                          ;
	uv_se_bdv_adj_d                   = 0                          ;
	uv_se_bdv_adj_e                   = 0                          ;
	uv_se_bdv_adj_f                   = 0                          ;

	uv_fusion_mv_judge_thres          = C_SMJ_THRES                ;
	uv_fusion_s_blur_wei              = C_BSA_STREN                ;
	uv_fusion_m_blur_wei              = C_BMA_STREN                ;

	if (C_ESA_PEAK < 5 )
		C_ESA_PEAK = 5;
	if (C_ESA_PEAK > 95)
		C_ESA_PEAK = 95;
	if (C_ESA_THRES > 100)
		C_ESA_THRES = 100;

	uv_fusion_s_sgm_edge_x0             = C_ESA_THRES                ;
	uv_fusion_s_sgm_edge_x1             = C_ESA_THRES - (((C_ESA_THRES-20)*C_ESA_PEAK)/100);
	uv_fusion_s_sgm_edge_x2             = 20                         ;
	uv_fusion_s_sgm_edge_y0             = C_ESA_STREN_H              ;
	uv_fusion_s_sgm_edge_y1             = C_ESA_STREN_L              ;

	if (C_PSA_PEAK < 5 )
		C_PSA_PEAK = 5;
	if (C_PSA_PEAK > 95)
		C_PSA_PEAK = 95;

	uv_fusion_s_sgm_pfr_x0            = C_PSA_THRES                ;
	uv_fusion_s_sgm_pfr_x1            = C_PSA_THRES + (((200-C_PSA_THRES)*C_PSA_PEAK)/100);
	uv_fusion_s_sgm_pfr_x2            = 200                        ;
	uv_fusion_s_sgm_pfr_y0            = C_PSA_STREN_H              ;
	uv_fusion_s_sgm_pfr_y1            = C_PSA_STREN_L              ;

	uv_fusion_s_org_br_supres_thres   = C_OSB_THRES                ;
	uv_fusion_s_org_br_supres_slope   = C_OSB_SLOPE                ;
	uv_fusion_s_org_dk_supres_thres   = C_OSD_THRES                ;
	uv_fusion_s_org_dk_supres_slope   = C_OSD_SLOPE                ;

	if (C_EMA_PEAK < 5 )
		C_EMA_PEAK = 5;
	if (C_EMA_PEAK > 95)
		C_EMA_PEAK = 95;
	if (C_EMA_THRES > 100)
		C_EMA_THRES = 100;

	uv_fusion_m_sgm_edge_x0             = C_EMA_THRES                ;
	uv_fusion_m_sgm_edge_x1             = C_EMA_THRES - (((C_EMA_THRES-20)*C_EMA_PEAK)/100);
	uv_fusion_m_sgm_edge_x2             = 20                         ;
	uv_fusion_m_sgm_edge_y0             = C_EMA_STREN_H              ;
	uv_fusion_m_sgm_edge_y1             = C_EMA_STREN_L              ;

	if (C_PMA_PEAK < 5 )
		C_PMA_PEAK = 5 ;
	if (C_PMA_PEAK > 95)
		C_PMA_PEAK = 95;

	uv_fusion_m_sgm_pfr_x0            = C_PMA_THRES                ;
	uv_fusion_m_sgm_pfr_x1            = C_PMA_THRES + (((200-C_PMA_THRES)*C_PMA_PEAK)/100);
	uv_fusion_m_sgm_pfr_x2            = 200                        ;
	uv_fusion_m_sgm_pfr_y0            = C_PMA_STREN_H              ;
	uv_fusion_m_sgm_pfr_y1            = C_PMA_STREN_L              ;

	uv_fusion_m_org_br_supres_thres   = C_OMB_THRES                ;
	uv_fusion_m_org_br_supres_slope   = C_OMB_SLOPE                ;
	uv_fusion_m_org_dk_supres_thres   = C_OMD_THRES                ;
	uv_fusion_m_org_dk_supres_slope   = C_OMD_SLOPE                ;

	uv_psn_max_num                    = C_TDN_MAXNUM               ;

	if (C_LCK_EN == 1)
		C_TDN_TYPE = 0;

	uv_psn_incr_type                  = C_TDN_TYPE                 ;
	uv_psn_share_sta_adj              = 0                          ;
	uv_psn_wei_step                   = C_TDN_STEP                 ;
	uv_psn_wei_limit                  = C_TDN_LMT                  ;
	uv_psn_max_num_wei                = C_TDN_LMT                  ;
	uv_psn_start_wei                  = 50                         ;
	uv_sta_blk_size_w                 = C_TDN_WIN                  ;
	uv_sta_blk_size_h                 = C_TDN_WIN                  ;
	uv_sta_blur_wei_opt               = uv_se_blur_wei_opt         ;
	uv_sta_mv_blk_bdv_x0_adj          = 0                          ;
	uv_sta_mv_blk_pdt_adj             = 0                          ;
	uv_sta_diff_thres_val             = C_TDN_THRES                ;
	uv_sta_diff_thres_val_glb         = C_TDN_THRES                ;

	if (TOP_FUNC == 0x22a) {
		C_TDN_NUM = (C_TDN_NUM*1.0)/2;
	}
	uv_sta_mv_num_thres               = C_TDN_NUM                  ;

	uv_false_color_style              = 0                          ;
	uv_false_color_base               = 128                        ;

	uv_false_color_thres              = C_SDN_THRES                ;
	uv_false_color_slope              = C_SDN_STREN                ;

	if (y_fs_sgm_corr_ad_x1 == y_fs_sgm_corr_ad_x0) {
		y_fs_sgm_corr_ad_s1 = 0;
	} else {
		y_fs_sgm_corr_ad_s1 = (y_fs_sgm_corr_ad_y0 - y_fs_sgm_corr_ad_y1)*8.0/(y_fs_sgm_corr_ad_x1 - y_fs_sgm_corr_ad_x0);
	}

	if (y_fs_sgm_corr_ad_x2 == y_fs_sgm_corr_ad_x1) {
		y_fs_sgm_corr_ad_s2 = 0;
	} else {
		y_fs_sgm_corr_ad_s2 = (y_fs_sgm_corr_ad_y1 - y_fs_sgm_corr_ad_y2)*8.0/(y_fs_sgm_corr_ad_x2 - y_fs_sgm_corr_ad_x1);
	}

	if (y_fs_sgm_corr_ad_x3 == y_fs_sgm_corr_ad_x2) {
		y_fs_sgm_corr_ad_s3 = 0;
	} else {
		y_fs_sgm_corr_ad_s3 = (y_fs_sgm_corr_ad_y2 - 0                  )*8.0/(y_fs_sgm_corr_ad_x3 - y_fs_sgm_corr_ad_x2);
	}

	if (y_fs_sgm_edge_ad_x1 == y_fs_sgm_edge_ad_x0) {
		y_fs_sgm_edge_ad_s1 = 0;
	} else {
		y_fs_sgm_edge_ad_s1 = (y_fs_sgm_edge_ad_y0 - y_fs_sgm_edge_ad_y1)*8.0/(y_fs_sgm_edge_ad_x1 - y_fs_sgm_edge_ad_x0);
	}

	if (y_fs_sgm_edge_ad_x2 == y_fs_sgm_edge_ad_x1) {
		y_fs_sgm_edge_ad_s2 = 0;
	} else {
		y_fs_sgm_edge_ad_s2 = (y_fs_sgm_edge_ad_y1 - y_fs_sgm_edge_ad_y2)*8.0/(y_fs_sgm_edge_ad_x2 - y_fs_sgm_edge_ad_x1);
	}

	if (y_fs_sgm_edge_ad_x3 == y_fs_sgm_edge_ad_x2) {
		y_fs_sgm_edge_ad_s3 = 0;
	} else {
		y_fs_sgm_edge_ad_s3 = (y_fs_sgm_edge_ad_y2 - 0                  )*8.0/(y_fs_sgm_edge_ad_x3 - y_fs_sgm_edge_ad_x2);
	}

	if (y_se_sgm_bdv_x1 == y_se_sgm_bdv_x0){
		y_se_sgm_bdv_s1     = 0;
	} else {
		y_se_sgm_bdv_s1     = (y_se_sgm_bdv_y0 - y_se_sgm_bdv_y1)*8.0/(y_se_sgm_bdv_x1 - y_se_sgm_bdv_x0) ;
	}

	if (y_se_sgm_bdv_x2 == y_se_sgm_bdv_x1){
		y_se_sgm_bdv_s2     = 0;
	} else {
		y_se_sgm_bdv_s2     = (y_se_sgm_bdv_y1 - y_se_sgm_bdv_y2)*8.0/(y_se_sgm_bdv_x2 - y_se_sgm_bdv_x1) ;
	}

	if (y_se_sgm_bdv_x3 == y_se_sgm_bdv_x2){
		y_se_sgm_bdv_s3     = 0;
	} else {
		y_se_sgm_bdv_s3     = (y_se_sgm_bdv_y2 - y_se_sgm_bdv_y3)*8.0/(y_se_sgm_bdv_x3 - y_se_sgm_bdv_x2) ;
	}

	if (y_se_sgm_bdv_x4 == y_se_sgm_bdv_x3){
		y_se_sgm_bdv_s4     = 0;
	} else {
		y_se_sgm_bdv_s4     = (y_se_sgm_bdv_y3 - 0              )*8.0/(y_se_sgm_bdv_x4 - y_se_sgm_bdv_x3) ;
	}

	if (y_fusion_s_sgm_edge_x0 == y_fusion_s_sgm_edge_x1) {
		y_fusion_s_sgm_edge_s1 = 0;
	} else {
		y_fusion_s_sgm_edge_s1 = (y_fusion_s_sgm_edge_y0 - y_fusion_s_sgm_edge_y1)*8.0/(y_fusion_s_sgm_edge_x0 - y_fusion_s_sgm_edge_x1);
	}

	if (y_fusion_s_sgm_edge_x1 == y_fusion_s_sgm_edge_x2) {
		y_fusion_s_sgm_edge_s2 = 0;
	} else {
		y_fusion_s_sgm_edge_s2 = (y_fusion_s_sgm_edge_y1 - y_fusion_s_sgm_edge_y2)*8.0/(y_fusion_s_sgm_edge_x1 - y_fusion_s_sgm_edge_x2);
	}

	if (y_fusion_s_sgm_edge_x2 == y_fusion_s_sgm_edge_x3) {
		y_fusion_s_sgm_edge_s3 = 0;
	} else {
		y_fusion_s_sgm_edge_s3 = (y_fusion_s_sgm_edge_y2 - 0                     )*8.0/(y_fusion_s_sgm_edge_x2 - y_fusion_s_sgm_edge_x3);
	}


	if (y_fusion_s_sgm_pfr_x1 == y_fusion_s_sgm_pfr_x0) {
		y_fusion_s_sgm_pfr_s1  = 0;
	} else {
		y_fusion_s_sgm_pfr_s1  = (y_fusion_s_sgm_pfr_y0 - y_fusion_s_sgm_pfr_y1)*8.0/(y_fusion_s_sgm_pfr_x1 - y_fusion_s_sgm_pfr_x0);
	}

	if (y_fusion_s_sgm_pfr_x2 == y_fusion_s_sgm_pfr_x1) {
		y_fusion_s_sgm_pfr_s2  = 0;
	} else {
		y_fusion_s_sgm_pfr_s2  = (y_fusion_s_sgm_pfr_y1 - y_fusion_s_sgm_pfr_y2)*8.0/(y_fusion_s_sgm_pfr_x2 - y_fusion_s_sgm_pfr_x1);
	}

	if (y_fusion_s_sgm_pfr_x3 == y_fusion_s_sgm_pfr_x2) {
		y_fusion_s_sgm_pfr_s3  = 0;
	} else {
		y_fusion_s_sgm_pfr_s3  = (y_fusion_s_sgm_pfr_y2 - 0                    )*8.0/(y_fusion_s_sgm_pfr_x3 - y_fusion_s_sgm_pfr_x2);
	}

	if (y_fusion_m_sgm_edge_x0 == y_fusion_m_sgm_edge_x1) {
		y_fusion_m_sgm_edge_s1 = 0;
	} else {
		y_fusion_m_sgm_edge_s1 = (y_fusion_m_sgm_edge_y0 - y_fusion_m_sgm_edge_y1)*8.0/(y_fusion_m_sgm_edge_x0 - y_fusion_m_sgm_edge_x1);
	}

	if (y_fusion_m_sgm_edge_x1 == y_fusion_m_sgm_edge_x2) {
		y_fusion_m_sgm_edge_s2 = 0;
	} else {
		y_fusion_m_sgm_edge_s2 = (y_fusion_m_sgm_edge_y1 - y_fusion_m_sgm_edge_y2)*8.0/(y_fusion_m_sgm_edge_x1 - y_fusion_m_sgm_edge_x2);
	}

	if (y_fusion_m_sgm_edge_x2 == y_fusion_m_sgm_edge_x3) {
		y_fusion_m_sgm_edge_s3 = 0;
	} else {
		y_fusion_m_sgm_edge_s3 = (y_fusion_m_sgm_edge_y2 - 0                     )*8.0/(y_fusion_m_sgm_edge_x2 - y_fusion_m_sgm_edge_x3);
	}

	if (y_fusion_m_sgm_pfr_x1 == y_fusion_m_sgm_pfr_x0) {
		y_fusion_m_sgm_pfr_s1  = 0;
	} else {
		y_fusion_m_sgm_pfr_s1  = (y_fusion_m_sgm_pfr_y0 - y_fusion_m_sgm_pfr_y1)*8.0/(y_fusion_m_sgm_pfr_x1 - y_fusion_m_sgm_pfr_x0);
	}

	if (y_fusion_m_sgm_pfr_x2 == y_fusion_m_sgm_pfr_x1) {
		y_fusion_m_sgm_pfr_s2  = 0;
	} else {
		y_fusion_m_sgm_pfr_s2  = (y_fusion_m_sgm_pfr_y1 - y_fusion_m_sgm_pfr_y2)*8.0/(y_fusion_m_sgm_pfr_x2 - y_fusion_m_sgm_pfr_x1);
	}

	if (y_fusion_m_sgm_pfr_x3 == y_fusion_m_sgm_pfr_x2) {
		y_fusion_m_sgm_pfr_s3  = 0;
	} else {
		y_fusion_m_sgm_pfr_s3  = (y_fusion_m_sgm_pfr_y2 - 0                    )*8.0/(y_fusion_m_sgm_pfr_x3 - y_fusion_m_sgm_pfr_x2);
	}

	if (y_bi_sgm_p_x0 == 0) {
		y_bi_sgm_p_s0 = 0 ;
	} else {
		y_bi_sgm_p_s0 = (y_bi_sgm_p_y0 - y_bi_sgm_p_y1)*8.0/(y_bi_sgm_p_x0 - 0            ) ;
	}

	if (y_bi_sgm_p_x1 == y_bi_sgm_p_x0) {
		y_bi_sgm_p_s1 = 0 ;
	} else {
		y_bi_sgm_p_s1 = (y_bi_sgm_p_y1 - y_bi_sgm_p_y2)*8.0/(y_bi_sgm_p_x1 - y_bi_sgm_p_x0) ;
	}

	if (y_bi_sgm_p_x2 == y_bi_sgm_p_x1) {
		y_bi_sgm_p_s2 = 0 ;
	} else {
		y_bi_sgm_p_s2 = (y_bi_sgm_p_y2 - y_bi_sgm_p_y3)*8.0/(y_bi_sgm_p_x2 - y_bi_sgm_p_x1) ;
	}

	if (y_bi_sgm_p_x3 == y_bi_sgm_p_x2) {
		y_bi_sgm_p_s3 = 0 ;
	} else {
		y_bi_sgm_p_s3 = (y_bi_sgm_p_y3 - 0            )*8.0/(y_bi_sgm_p_x3 - y_bi_sgm_p_x2) ;
	}


	if (uv_fs_sgm_corr_ad_x1 == uv_fs_sgm_corr_ad_x0) {
		uv_fs_sgm_corr_ad_s1 = 0;
	} else {
		uv_fs_sgm_corr_ad_s1 = (uv_fs_sgm_corr_ad_y0 - uv_fs_sgm_corr_ad_y1)*4.0/(uv_fs_sgm_corr_ad_x1 - uv_fs_sgm_corr_ad_x0);
	}

	if (uv_fs_sgm_corr_ad_x2 == uv_fs_sgm_corr_ad_x1) {
		uv_fs_sgm_corr_ad_s2 = 0;
	} else {
		uv_fs_sgm_corr_ad_s2 = (uv_fs_sgm_corr_ad_y1 - 0                   )*4.0/(uv_fs_sgm_corr_ad_x2 - uv_fs_sgm_corr_ad_x1);
	}

	if (uv_fs_sgm_edge_ad_x1 == uv_fs_sgm_edge_ad_x0) {
		uv_fs_sgm_edge_ad_s1 = 0;
	} else {
		uv_fs_sgm_edge_ad_s1 = (uv_fs_sgm_edge_ad_y0 - uv_fs_sgm_edge_ad_y1)*4.0/(uv_fs_sgm_edge_ad_x1 - uv_fs_sgm_edge_ad_x0);
	}

	if (uv_fs_sgm_edge_ad_x2 == uv_fs_sgm_edge_ad_x1) {
		uv_fs_sgm_edge_ad_s2 = 0;
	} else {
		uv_fs_sgm_edge_ad_s2 = (uv_fs_sgm_edge_ad_y1 - 0                   )*4.0/(uv_fs_sgm_edge_ad_x2 - uv_fs_sgm_edge_ad_x1);
	}

	if (uv_se_sgm_bdv_x1 == uv_se_sgm_bdv_x0) {
		uv_se_sgm_bdv_s1     = 0;
	} else {
		uv_se_sgm_bdv_s1     = (uv_se_sgm_bdv_y0 - uv_se_sgm_bdv_y1)*4.0/(uv_se_sgm_bdv_x1 - uv_se_sgm_bdv_x0) ;
	}

	if (uv_se_sgm_bdv_x2 == uv_se_sgm_bdv_x1) {
		uv_se_sgm_bdv_s2     = 0;
	} else {
		uv_se_sgm_bdv_s2     = (uv_se_sgm_bdv_y1 - uv_se_sgm_bdv_y2)*4.0/(uv_se_sgm_bdv_x2 - uv_se_sgm_bdv_x1) ;
	}

	if (uv_se_sgm_bdv_x3 == uv_se_sgm_bdv_x2) {
		uv_se_sgm_bdv_s3     = 0;
	} else {
		uv_se_sgm_bdv_s3     = (uv_se_sgm_bdv_y2 - 0               )*4.0/(uv_se_sgm_bdv_x3 - uv_se_sgm_bdv_x2) ;
	}

	if (uv_fusion_s_sgm_edge_x0 == uv_fusion_s_sgm_edge_x1) {
		uv_fusion_s_sgm_edge_s1 = 0;
	} else {
		uv_fusion_s_sgm_edge_s1 = (uv_fusion_s_sgm_edge_y0 - uv_fusion_s_sgm_edge_y1)*4.0/(uv_fusion_s_sgm_edge_x0 - uv_fusion_s_sgm_edge_x1);
	}

	if (uv_fusion_s_sgm_edge_x1 == uv_fusion_s_sgm_edge_x2) {
		uv_fusion_s_sgm_edge_s2 = 0;
	} else {
		uv_fusion_s_sgm_edge_s2 = (uv_fusion_s_sgm_edge_y1 - 0                      )*4.0/(uv_fusion_s_sgm_edge_x1 - uv_fusion_s_sgm_edge_x2);
	}

	if (uv_fusion_s_sgm_pfr_x1 == uv_fusion_s_sgm_pfr_x0) {
		uv_fusion_s_sgm_pfr_s1  = 0;
	} else {
		uv_fusion_s_sgm_pfr_s1  = (uv_fusion_s_sgm_pfr_y0 - uv_fusion_s_sgm_pfr_y1)*4.0/(uv_fusion_s_sgm_pfr_x1 - uv_fusion_s_sgm_pfr_x0);
	}

	if (uv_fusion_s_sgm_pfr_x2 == uv_fusion_s_sgm_pfr_x1) {
		uv_fusion_s_sgm_pfr_s2  = 0;
	} else {
		uv_fusion_s_sgm_pfr_s2  = (uv_fusion_s_sgm_pfr_y1 - 0                     )*4.0/(uv_fusion_s_sgm_pfr_x2 - uv_fusion_s_sgm_pfr_x1);
	}

	if (uv_fusion_m_sgm_edge_x0 == uv_fusion_m_sgm_edge_x1) {
		uv_fusion_m_sgm_edge_s1 = 0;
	} else {
		uv_fusion_m_sgm_edge_s1 = (uv_fusion_m_sgm_edge_y0 - uv_fusion_m_sgm_edge_y1)*4.0/(uv_fusion_m_sgm_edge_x0 - uv_fusion_m_sgm_edge_x1);
	}

	if (uv_fusion_m_sgm_edge_x1 == uv_fusion_m_sgm_edge_x2) {
		uv_fusion_m_sgm_edge_s2 = 0;
	} else {
		uv_fusion_m_sgm_edge_s2 = (uv_fusion_m_sgm_edge_y1 - 0                      )*4.0/(uv_fusion_m_sgm_edge_x1 - uv_fusion_m_sgm_edge_x2);
	}

	if (uv_fusion_m_sgm_pfr_x1 == uv_fusion_m_sgm_pfr_x0) {
		uv_fusion_m_sgm_pfr_s1  = 0;
	} else {
		uv_fusion_m_sgm_pfr_s1  = (uv_fusion_m_sgm_pfr_y0 - uv_fusion_m_sgm_pfr_y1)*4.0/(uv_fusion_m_sgm_pfr_x1 - uv_fusion_m_sgm_pfr_x0);
	}

	if (uv_fusion_m_sgm_pfr_x2 == uv_fusion_m_sgm_pfr_x1) {
		uv_fusion_m_sgm_pfr_s2  = 0;
	} else {
		uv_fusion_m_sgm_pfr_s2  = (uv_fusion_m_sgm_pfr_y1 - 0                     )*4.0/(uv_fusion_m_sgm_pfr_x2 - uv_fusion_m_sgm_pfr_x1);
	}

	if (y_fs_sgm_corr_ad_s1 >= 128)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fs_sgm_corr_ad_s1     value = %d out of range !!!",y_fs_sgm_corr_ad_s1);
	if (y_fs_sgm_corr_ad_s2 >= 128)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fs_sgm_corr_ad_s2     value = %d out of range !!!",y_fs_sgm_corr_ad_s2) ;
	if (y_fs_sgm_corr_ad_s3 >= 128)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fs_sgm_corr_ad_s3     value = %d out of range !!!",y_fs_sgm_corr_ad_s3) ;
	if (y_fs_sgm_edge_ad_s1 >= 32 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fs_sgm_edge_ad_s1     value = %d out of range !!!",y_fs_sgm_edge_ad_s1);
	if (y_fs_sgm_edge_ad_s2 >= 32 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fs_sgm_edge_ad_s2     value = %d out of range !!!",y_fs_sgm_edge_ad_s2) ;
	if (y_fs_sgm_edge_ad_s3 >= 32 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fs_sgm_edge_ad_s3     value = %d out of range !!!",y_fs_sgm_edge_ad_s3) ;
	if (y_se_sgm_bdv_s1 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_se_sgm_bdv_s1         value = %d out of range !!!",y_se_sgm_bdv_s1);
	if (y_se_sgm_bdv_s2 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_se_sgm_bdv_s2         value = %d out of range !!!",y_se_sgm_bdv_s2);
	if (y_se_sgm_bdv_s3 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_se_sgm_bdv_s3         value = %d out of range !!!",y_se_sgm_bdv_s3);
	if (y_se_sgm_bdv_s4 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_se_sgm_bdv_s4         value = %d out of range !!!",y_se_sgm_bdv_s4);
	if (y_fusion_s_sgm_edge_s1 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_s_sgm_edge_s1  value = %d out of range !!!",y_fusion_s_sgm_edge_s1);
	if (y_fusion_s_sgm_edge_s2 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_s_sgm_edge_s2  value = %d out of range !!!",y_fusion_s_sgm_edge_s2);
	if (y_fusion_s_sgm_edge_s3 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_s_sgm_edge_s3  value = %d out of range !!!",y_fusion_s_sgm_edge_s3);
	if (y_fusion_s_sgm_pfr_s1 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_s_sgm_pfr_s1   value = %d out of range !!!",y_fusion_s_sgm_pfr_s1);
	if (y_fusion_s_sgm_pfr_s2 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_s_sgm_pfr_s2   value = %d out of range !!!",y_fusion_s_sgm_pfr_s2);
	if (y_fusion_s_sgm_pfr_s3 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_s_sgm_pfr_s3   value = %d out of range !!!",y_fusion_s_sgm_pfr_s3);
	if (y_fusion_m_sgm_edge_s1 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_m_sgm_edge_s1  value = %d out of range !!!",y_fusion_m_sgm_edge_s1);
	if (y_fusion_m_sgm_edge_s2 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_m_sgm_edge_s2  value = %d out of range !!!",y_fusion_m_sgm_edge_s2);
	if (y_fusion_m_sgm_edge_s3 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_m_sgm_edge_s3  value = %d out of range !!!",y_fusion_m_sgm_edge_s3);
	if (y_fusion_m_sgm_pfr_s1 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_m_sgm_pfr_s1   value = %d out of range !!!",y_fusion_m_sgm_pfr_s1);
	if (y_fusion_m_sgm_pfr_s2 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_m_sgm_pfr_s2   value = %d out of range !!!",y_fusion_m_sgm_pfr_s2);
	if (y_fusion_m_sgm_pfr_s3 >= 1024)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_fusion_m_sgm_pfr_s3   value = %d out of range !!!",y_fusion_m_sgm_pfr_s3);
	if (y_bi_sgm_p_s0 >= 64 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_bi_sgm_p_s0          value = %d out of range !!!",y_bi_sgm_p_s0);
	if (y_bi_sgm_p_s1 >= 64 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_bi_sgm_p_s1          value = %d out of range !!!",y_bi_sgm_p_s1);
	if (y_bi_sgm_p_s2 >= 64 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_bi_sgm_p_s2          value = %d out of range !!!",y_bi_sgm_p_s2);
	if (y_bi_sgm_p_s3 >= 64 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : y_bi_sgm_p_s3          value = %d out of range !!!",y_bi_sgm_p_s3);
	if (uv_fs_sgm_corr_ad_s1 >= 64 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fs_sgm_corr_ad_s1    value = %d out of range !!!",uv_fs_sgm_corr_ad_s1);
	if (uv_fs_sgm_corr_ad_s2 >= 64 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fs_sgm_corr_ad_s2    value = %d out of range !!!",uv_fs_sgm_corr_ad_s2);
	if (uv_fs_sgm_edge_ad_s1 >= 16 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fs_sgm_edge_ad_s1    value = %d out of range !!!",uv_fs_sgm_edge_ad_s1);
	if (uv_fs_sgm_edge_ad_s2 >= 16 )
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fs_sgm_edge_ad_s2    value = %d out of range !!!",uv_fs_sgm_edge_ad_s2);
	if (uv_se_sgm_bdv_s1 >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_se_sgm_bdv_s1        value = %d out of range !!!",uv_se_sgm_bdv_s1);
	if (uv_se_sgm_bdv_s2 >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_se_sgm_bdv_s2        value = %d out of range !!!",uv_se_sgm_bdv_s2);
	if (uv_se_sgm_bdv_s3 >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_se_sgm_bdv_s3        value = %d out of range !!!",uv_se_sgm_bdv_s3);
	if (uv_fusion_s_sgm_edge_s1 >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_s_sgm_edge_s1 value = %d out of range !!!",uv_fusion_s_sgm_edge_s1);
	if (uv_fusion_s_sgm_edge_s2 >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_s_sgm_edge_s2 value = %d out of range !!!",uv_fusion_s_sgm_edge_s2);
	if (uv_fusion_s_sgm_pfr_s1  >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_s_sgm_pfr_s1  value = %d out of range !!!",uv_fusion_s_sgm_pfr_s1);
	if (uv_fusion_s_sgm_pfr_s2  >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_s_sgm_pfr_s2  value = %d out of range !!!",uv_fusion_s_sgm_pfr_s2);
	if (uv_fusion_m_sgm_edge_s1 >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_m_sgm_edge_s1 value = %d out of range !!!",uv_fusion_m_sgm_edge_s1);
	if (uv_fusion_m_sgm_edge_s2 >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_m_sgm_edge_s2 value = %d out of range !!!",uv_fusion_m_sgm_edge_s2);
	if (uv_fusion_m_sgm_pfr_s1  >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_m_sgm_pfr_s1  value = %d out of range !!!",uv_fusion_m_sgm_pfr_s1);
	if (uv_fusion_m_sgm_pfr_s2  >= 512)
		IMP_LOG_ERR(TAG,"@@@@ ncu function error info : uv_fusion_m_sgm_pfr_s2  value = %d out of range !!!",uv_fusion_m_sgm_pfr_s2);

	if (dump_en == 1){
		//IMP_LOG_DBG(TAG,"y_fs_ave_win_opt                       = %d \n",y_fs_ave_win_opt                  );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_x0                    = %d \n",y_fs_sgm_corr_ad_x0               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_x1                    = %d \n",y_fs_sgm_corr_ad_x1               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_x2                    = %d \n",y_fs_sgm_corr_ad_x2               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_x3                    = %d \n",y_fs_sgm_corr_ad_x3               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_y0                    = %d \n",y_fs_sgm_corr_ad_y0               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_y1                    = %d \n",y_fs_sgm_corr_ad_y1               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_y2                    = %d \n",y_fs_sgm_corr_ad_y2               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_s1                    = %d \n",y_fs_sgm_corr_ad_s1               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_s2                    = %d \n",y_fs_sgm_corr_ad_s2               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_corr_ad_s3                    = %d \n",y_fs_sgm_corr_ad_s3               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_x0                    = %d \n",y_fs_sgm_edge_ad_x0               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_x1                    = %d \n",y_fs_sgm_edge_ad_x1               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_x2                    = %d \n",y_fs_sgm_edge_ad_x2               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_x3                    = %d \n",y_fs_sgm_edge_ad_x3               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_y0                    = %d \n",y_fs_sgm_edge_ad_y0               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_y1                    = %d \n",y_fs_sgm_edge_ad_y1               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_y2                    = %d \n",y_fs_sgm_edge_ad_y2               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_s1                    = %d \n",y_fs_sgm_edge_ad_s1               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_s2                    = %d \n",y_fs_sgm_edge_ad_s2               );
		//IMP_LOG_DBG(TAG,"y_fs_sgm_edge_ad_s3                    = %d \n",y_fs_sgm_edge_ad_s3               );
		//IMP_LOG_DBG(TAG,"y_fs_pxl_diff_thres                    = %d \n",y_fs_pxl_diff_thres               );
		//IMP_LOG_DBG(TAG,"y_fs_pxl_fluct_thres                   = %d \n",y_fs_pxl_fluct_thres              );
		//IMP_LOG_DBG(TAG,"y_fs_pxl_limit                         = %d \n",y_fs_pxl_limit                    );
		//IMP_LOG_DBG(TAG,"y_fs_edge_type                         = %d \n",y_fs_edge_type                    );
		//IMP_LOG_DBG(TAG,"y_fs_edge_scope                        = %d \n",y_fs_edge_scope                   );
		//IMP_LOG_DBG(TAG,"y_fs_edge_value_thres                  = %d \n",y_fs_edge_value_thres             );
		//IMP_LOG_DBG(TAG,"y_fs_edge_huge_thres                   = %d \n",y_fs_edge_huge_thres              );
		//IMP_LOG_DBG(TAG,"y_fs_edge_diff_slope                   = %d \n",y_fs_edge_diff_slope              );
		//IMP_LOG_DBG(TAG,"y_fs_edge_diff_thres_low               = %d \n",y_fs_edge_diff_thres_low          );
		//IMP_LOG_DBG(TAG,"y_fs_edge_diff_thres_high              = %d \n",y_fs_edge_diff_thres_high         );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_hg_br_diff_thres            = %d \n",y_fs_fluct_hg_br_diff_thres       );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_hg_br_diff_slope            = %d \n",y_fs_fluct_hg_br_diff_slope       );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_hg_dk_diff_thres            = %d \n",y_fs_fluct_hg_dk_diff_thres       );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_hg_dk_diff_slope            = %d \n",y_fs_fluct_hg_dk_diff_slope       );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_uhg_br_diff_thres_low       = %d \n",y_fs_fluct_uhg_br_diff_thres_low  );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_uhg_br_diff_thres_high      = %d \n",y_fs_fluct_uhg_br_diff_thres_high );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_uhg_br_diff_slope           = %d \n",y_fs_fluct_uhg_br_diff_slope      );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_uhg_dk_diff_thres_low       = %d \n",y_fs_fluct_uhg_dk_diff_thres_low  );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_uhg_dk_diff_thres_high      = %d \n",y_fs_fluct_uhg_dk_diff_thres_high );
		//IMP_LOG_DBG(TAG,"y_fs_fluct_uhg_dk_diff_slope           = %d \n",y_fs_fluct_uhg_dk_diff_slope      );
		//IMP_LOG_DBG(TAG,"y_se_ref_image_sel                     = %d \n",y_se_ref_image_sel                );
		IMP_LOG_DBG(TAG,"y_se_ref_pixel_filter                  = %d \n",y_se_ref_pixel_filter             );
		//IMP_LOG_DBG(TAG,"y_se_ref_wei_motion_opt                = %d \n",y_se_ref_wei_motion_opt           );
		//IMP_LOG_DBG(TAG,"y_se_ref_wei_pseudo_still              = %d \n",y_se_ref_wei_pseudo_still         );
		IMP_LOG_DBG(TAG,"y_se_blur_win_opt                      = %d \n",y_se_blur_win_opt                 );
		IMP_LOG_DBG(TAG,"y_se_blur_wei_opt                      = %d \n",y_se_blur_wei_opt                 );
		//IMP_LOG_DBG(TAG,"y_se_line_diff_type                    = %d \n",y_se_line_diff_type               );
		//IMP_LOG_DBG(TAG,"y_se_line_diff_thres                   = %d \n",y_se_line_diff_thres              );
		//IMP_LOG_DBG(TAG,"y_se_pxl_diff_thres                    = %d \n",y_se_pxl_diff_thres               );
		//IMP_LOG_DBG(TAG,"y_se_win5_statis_diff_thres            = %d \n",y_se_win5_statis_diff_thres       );
		//IMP_LOG_DBG(TAG,"y_se_win5_statis_num_thres             = %d \n",y_se_win5_statis_num_thres        );
		IMP_LOG_DBG(TAG,"y_se_corner_length                     = %d \n",y_se_corner_length                );
		IMP_LOG_DBG(TAG,"y_se_corner_case_bdv_adj               = %d \n",y_se_corner_case_bdv_adj          );
		IMP_LOG_DBG(TAG,"y_se_corner_sta_thres_adj              = %d \n",y_se_corner_sta_thres_adj         );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_x0                        = %d \n",y_se_sgm_bdv_x0                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_x1                        = %d \n",y_se_sgm_bdv_x1                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_x2                        = %d \n",y_se_sgm_bdv_x2                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_x3                        = %d \n",y_se_sgm_bdv_x3                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_x4                        = %d \n",y_se_sgm_bdv_x4                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_y0                        = %d \n",y_se_sgm_bdv_y0                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_y1                        = %d \n",y_se_sgm_bdv_y1                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_y2                        = %d \n",y_se_sgm_bdv_y2                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_y3                        = %d \n",y_se_sgm_bdv_y3                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_s1                        = %d \n",y_se_sgm_bdv_s1                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_s2                        = %d \n",y_se_sgm_bdv_s2                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_s3                        = %d \n",y_se_sgm_bdv_s3                   );
		IMP_LOG_DBG(TAG,"y_se_sgm_bdv_s4                        = %d \n",y_se_sgm_bdv_s4                   );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_1                         = %d \n",y_se_bdv_adj_1                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_2                         = %d \n",y_se_bdv_adj_2                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_3                         = %d \n",y_se_bdv_adj_3                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_4                         = %d \n",y_se_bdv_adj_4                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_5                         = %d \n",y_se_bdv_adj_5                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_6                         = %d \n",y_se_bdv_adj_6                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_7                         = %d \n",y_se_bdv_adj_7                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_8                         = %d \n",y_se_bdv_adj_8                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_9                         = %d \n",y_se_bdv_adj_9                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_a                         = %d \n",y_se_bdv_adj_a                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_b                         = %d \n",y_se_bdv_adj_b                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_c                         = %d \n",y_se_bdv_adj_c                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_d                         = %d \n",y_se_bdv_adj_d                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_e                         = %d \n",y_se_bdv_adj_e                    );
		//IMP_LOG_DBG(TAG,"y_se_bdv_adj_f                         = %d \n",y_se_bdv_adj_f                    );
		//IMP_LOG_DBG(TAG,"y_fusion_blur_win_opt                  = %d \n",y_fusion_blur_win_opt             );
		IMP_LOG_DBG(TAG,"y_fusion_mv_judge_thres                = %d \n",y_fusion_mv_judge_thres           );
		IMP_LOG_DBG(TAG,"y_fusion_s_blur_wei                    = %d \n",y_fusion_s_blur_wei               );
		IMP_LOG_DBG(TAG,"y_fusion_m_blur_wei                    = %d \n",y_fusion_m_blur_wei               );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_x0                 = %d \n",y_fusion_s_sgm_edge_x0            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_x1                 = %d \n",y_fusion_s_sgm_edge_x1            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_x2                 = %d \n",y_fusion_s_sgm_edge_x2            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_x3                 = %d \n",y_fusion_s_sgm_edge_x3            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_y0                 = %d \n",y_fusion_s_sgm_edge_y0            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_y1                 = %d \n",y_fusion_s_sgm_edge_y1            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_y2                 = %d \n",y_fusion_s_sgm_edge_y2            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_s1                 = %d \n",y_fusion_s_sgm_edge_s1            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_s2                 = %d \n",y_fusion_s_sgm_edge_s2            );
		//IMP_LOG_DBG(TAG,"y_fusion_s_sgm_edge_s3                 = %d \n",y_fusion_s_sgm_edge_s3            );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_x0                  = %d \n",y_fusion_s_sgm_pfr_x0             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_x1                  = %d \n",y_fusion_s_sgm_pfr_x1             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_x2                  = %d \n",y_fusion_s_sgm_pfr_x2             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_x3                  = %d \n",y_fusion_s_sgm_pfr_x3             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_y0                  = %d \n",y_fusion_s_sgm_pfr_y0             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_y1                  = %d \n",y_fusion_s_sgm_pfr_y1             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_y2                  = %d \n",y_fusion_s_sgm_pfr_y2             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_s1                  = %d \n",y_fusion_s_sgm_pfr_s1             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_s2                  = %d \n",y_fusion_s_sgm_pfr_s2             );
		IMP_LOG_DBG(TAG,"y_fusion_s_sgm_pfr_s3                  = %d \n",y_fusion_s_sgm_pfr_s3             );
		IMP_LOG_DBG(TAG,"y_fusion_s_org_br_supres_thres         = %d \n",y_fusion_s_org_br_supres_thres    );
		IMP_LOG_DBG(TAG,"y_fusion_s_org_br_supres_slope         = %d \n",y_fusion_s_org_br_supres_slope    );
		IMP_LOG_DBG(TAG,"y_fusion_s_org_dk_supres_thres         = %d \n",y_fusion_s_org_dk_supres_thres    );
		IMP_LOG_DBG(TAG,"y_fusion_s_org_dk_supres_slope         = %d \n",y_fusion_s_org_dk_supres_slope    );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_x0                 = %d \n",y_fusion_m_sgm_edge_x0            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_x1                 = %d \n",y_fusion_m_sgm_edge_x1            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_x2                 = %d \n",y_fusion_m_sgm_edge_x2            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_x3                 = %d \n",y_fusion_m_sgm_edge_x3            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_y0                 = %d \n",y_fusion_m_sgm_edge_y0            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_y1                 = %d \n",y_fusion_m_sgm_edge_y1            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_y2                 = %d \n",y_fusion_m_sgm_edge_y2            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_s1                 = %d \n",y_fusion_m_sgm_edge_s1            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_s2                 = %d \n",y_fusion_m_sgm_edge_s2            );
		//IMP_LOG_DBG(TAG,"y_fusion_m_sgm_edge_s3                 = %d \n",y_fusion_m_sgm_edge_s3            );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_x0                  = %d \n",y_fusion_m_sgm_pfr_x0             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_x1                  = %d \n",y_fusion_m_sgm_pfr_x1             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_x2                  = %d \n",y_fusion_m_sgm_pfr_x2             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_x3                  = %d \n",y_fusion_m_sgm_pfr_x3             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_y0                  = %d \n",y_fusion_m_sgm_pfr_y0             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_y1                  = %d \n",y_fusion_m_sgm_pfr_y1             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_y2                  = %d \n",y_fusion_m_sgm_pfr_y2             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_s1                  = %d \n",y_fusion_m_sgm_pfr_s1             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_s2                  = %d \n",y_fusion_m_sgm_pfr_s2             );
		IMP_LOG_DBG(TAG,"y_fusion_m_sgm_pfr_s3                  = %d \n",y_fusion_m_sgm_pfr_s3             );
		IMP_LOG_DBG(TAG,"y_fusion_m_org_br_supres_thres         = %d \n",y_fusion_m_org_br_supres_thres    );
		IMP_LOG_DBG(TAG,"y_fusion_m_org_br_supres_slope         = %d \n",y_fusion_m_org_br_supres_slope    );
		IMP_LOG_DBG(TAG,"y_fusion_m_org_dk_supres_thres         = %d \n",y_fusion_m_org_dk_supres_thres    );
		IMP_LOG_DBG(TAG,"y_fusion_m_org_dk_supres_slope         = %d \n",y_fusion_m_org_dk_supres_slope    );
		//IMP_LOG_DBG(TAG,"y_psn_max_num                          = %d \n",y_psn_max_num                     );
		//IMP_LOG_DBG(TAG,"y_psn_incr_type                        = %d \n",y_psn_incr_type                   );
		//IMP_LOG_DBG(TAG,"y_psn_share_sta_adj                    = %d \n",y_psn_share_sta_adj               );
		//IMP_LOG_DBG(TAG,"y_psn_wei_step                         = %d \n",y_psn_wei_step                    );
		IMP_LOG_DBG(TAG,"y_psn_wei_limit                        = %d \n",y_psn_wei_limit                   );
		//IMP_LOG_DBG(TAG,"y_psn_max_num_wei                      = %d \n",y_psn_max_num_wei                 );
		//IMP_LOG_DBG(TAG,"y_psn_start_wei                        = %d \n",y_psn_start_wei                   );
		IMP_LOG_DBG(TAG,"y_sta_blk_size_w                       = %d \n",y_sta_blk_size_w                  );
		IMP_LOG_DBG(TAG,"y_sta_blk_size_h                       = %d \n",y_sta_blk_size_h                  );
		IMP_LOG_DBG(TAG,"y_sta_blur_win_opt                     = %d \n",y_sta_blur_win_opt                );
		IMP_LOG_DBG(TAG,"y_sta_blur_wei_opt                     = %d \n",y_sta_blur_wei_opt                );
		//IMP_LOG_DBG(TAG,"y_sta_mv_blk_bdv_x0_adj                = %d \n",y_sta_mv_blk_bdv_x0_adj           );
		//IMP_LOG_DBG(TAG,"y_sta_mv_blk_pdt_adj                   = %d \n",y_sta_mv_blk_pdt_adj              );
		IMP_LOG_DBG(TAG,"y_sta_diff_thres_val                   = %d \n",y_sta_diff_thres_val              );
		//IMP_LOG_DBG(TAG,"y_sta_diff_thres_val_glb               = %d \n",y_sta_diff_thres_val_glb          );
		IMP_LOG_DBG(TAG,"y_sta_mv_num_thres                     = %d \n",y_sta_mv_num_thres                );
		IMP_LOG_DBG(TAG,"y_br_area_thres                        = %d \n",y_br_area_thres                   );
		IMP_LOG_DBG(TAG,"y_br_area_bdv_adj_dir                  = %d \n",y_br_area_bdv_adj_dir             );
		IMP_LOG_DBG(TAG,"y_br_area_bdv_adj_value                = %d \n",y_br_area_bdv_adj_value           );
		IMP_LOG_DBG(TAG,"y_dk_area_thres                        = %d \n",y_dk_area_thres                   );
		IMP_LOG_DBG(TAG,"y_dk_area_bdv_adj_dir                  = %d \n",y_dk_area_bdv_adj_dir             );
		IMP_LOG_DBG(TAG,"y_dk_area_bdv_adj_value                = %d \n",y_dk_area_bdv_adj_value           );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_x0                          = %d \n",y_bi_sgm_p_x0                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_x1                          = %d \n",y_bi_sgm_p_x1                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_x2                          = %d \n",y_bi_sgm_p_x2                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_x3                          = %d \n",y_bi_sgm_p_x3                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_y0                          = %d \n",y_bi_sgm_p_y0                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_y1                          = %d \n",y_bi_sgm_p_y1                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_y2                          = %d \n",y_bi_sgm_p_y2                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_y3                          = %d \n",y_bi_sgm_p_y3                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_s0                          = %d \n",y_bi_sgm_p_s0                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_s1                          = %d \n",y_bi_sgm_p_s1                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_s2                          = %d \n",y_bi_sgm_p_s2                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_p_s3                          = %d \n",y_bi_sgm_p_s3                     );
		IMP_LOG_DBG(TAG,"y_bi_sgm_g_0                           = %d \n",y_bi_sgm_g_0                      );
		IMP_LOG_DBG(TAG,"y_bi_sgm_g_1                           = %d \n",y_bi_sgm_g_1                      );
		IMP_LOG_DBG(TAG,"y_bi_sgm_g_2                           = %d \n",y_bi_sgm_g_2                      );
		IMP_LOG_DBG(TAG,"y_bi_sgm_g_3                           = %d \n",y_bi_sgm_g_3                      );
		IMP_LOG_DBG(TAG,"y_bi_sgm_g_4                           = %d \n",y_bi_sgm_g_4                      );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_corr_ad_x0                   = %d \n",uv_fs_sgm_corr_ad_x0              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_corr_ad_x1                   = %d \n",uv_fs_sgm_corr_ad_x1              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_corr_ad_x2                   = %d \n",uv_fs_sgm_corr_ad_x2              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_corr_ad_y0                   = %d \n",uv_fs_sgm_corr_ad_y0              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_corr_ad_y1                   = %d \n",uv_fs_sgm_corr_ad_y1              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_corr_ad_s1                   = %d \n",uv_fs_sgm_corr_ad_s1              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_corr_ad_s2                   = %d \n",uv_fs_sgm_corr_ad_s2              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_edge_ad_x0                   = %d \n",uv_fs_sgm_edge_ad_x0              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_edge_ad_x1                   = %d \n",uv_fs_sgm_edge_ad_x1              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_edge_ad_x2                   = %d \n",uv_fs_sgm_edge_ad_x2              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_edge_ad_y0                   = %d \n",uv_fs_sgm_edge_ad_y0              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_edge_ad_y1                   = %d \n",uv_fs_sgm_edge_ad_y1              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_edge_ad_s1                   = %d \n",uv_fs_sgm_edge_ad_s1              );
		//IMP_LOG_DBG(TAG,"uv_fs_sgm_edge_ad_s2                   = %d \n",uv_fs_sgm_edge_ad_s2              );
		//IMP_LOG_DBG(TAG,"uv_fs_pxl_diff_thres                   = %d \n",uv_fs_pxl_diff_thres              );
		//IMP_LOG_DBG(TAG,"uv_fs_pxl_fluct_thres                  = %d \n",uv_fs_pxl_fluct_thres             );
		//IMP_LOG_DBG(TAG,"uv_fs_pxl_limit                        = %d \n",uv_fs_pxl_limit                   );
		//IMP_LOG_DBG(TAG,"uv_fs_edge_type                        = %d \n",uv_fs_edge_type                   );
		//IMP_LOG_DBG(TAG,"uv_fs_edge_value_thres                 = %d \n",uv_fs_edge_value_thres            );
		//IMP_LOG_DBG(TAG,"uv_fs_edge_huge_thres                  = %d \n",uv_fs_edge_huge_thres             );
		//IMP_LOG_DBG(TAG,"uv_fs_edge_diff_slope                  = %d \n",uv_fs_edge_diff_slope             );
		//IMP_LOG_DBG(TAG,"uv_fs_edge_diff_thres_low              = %d \n",uv_fs_edge_diff_thres_low         );
		//IMP_LOG_DBG(TAG,"uv_fs_edge_diff_thres_high             = %d \n",uv_fs_edge_diff_thres_high        );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_hg_br_diff_thres           = %d \n",uv_fs_fluct_hg_br_diff_thres      );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_hg_br_diff_slope           = %d \n",uv_fs_fluct_hg_br_diff_slope      );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_hg_dk_diff_thres           = %d \n",uv_fs_fluct_hg_dk_diff_thres      );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_hg_dk_diff_slope           = %d \n",uv_fs_fluct_hg_dk_diff_slope      );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_uhg_br_diff_thres_low      = %d \n",uv_fs_fluct_uhg_br_diff_thres_low );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_uhg_br_diff_thres_high     = %d \n",uv_fs_fluct_uhg_br_diff_thres_high);
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_uhg_br_diff_slope          = %d \n",uv_fs_fluct_uhg_br_diff_slope     );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_uhg_dk_diff_thres_low      = %d \n",uv_fs_fluct_uhg_dk_diff_thres_low );
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_uhg_dk_diff_thres_high     = %d \n",uv_fs_fluct_uhg_dk_diff_thres_high);
		//IMP_LOG_DBG(TAG,"uv_fs_fluct_uhg_dk_diff_slope          = %d \n",uv_fs_fluct_uhg_dk_diff_slope     );
		IMP_LOG_DBG(TAG,"uv_se_ref_pixel_filter                 = %d \n",uv_se_ref_pixel_filter            );
		//IMP_LOG_DBG(TAG,"uv_se_ref_wei_motion_opt               = %d \n",uv_se_ref_wei_motion_opt          );
		//IMP_LOG_DBG(TAG,"uv_se_ref_wei_pseudo_still             = %d \n",uv_se_ref_wei_pseudo_still        );
		IMP_LOG_DBG(TAG,"uv_se_blur_wei_opt                     = %d \n",uv_se_blur_wei_opt                );
		//IMP_LOG_DBG(TAG,"uv_se_line_diff_type                   = %d \n",uv_se_line_diff_type              );
		//IMP_LOG_DBG(TAG,"uv_se_pxl_diff_thres                   = %d \n",uv_se_pxl_diff_thres              );
		//IMP_LOG_DBG(TAG,"uv_se_line_diff_thres                  = %d \n",uv_se_line_diff_thres             );
		IMP_LOG_DBG(TAG,"uv_se_corner_length                    = %d \n",uv_se_corner_length               );
		IMP_LOG_DBG(TAG,"uv_se_corner_case_bdv_adj              = %d \n",uv_se_corner_case_bdv_adj         );
		IMP_LOG_DBG(TAG,"uv_se_corner_sta_thres_adj             = %d \n",uv_se_corner_sta_thres_adj        );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_x0                       = %d \n",uv_se_sgm_bdv_x0                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_x1                       = %d \n",uv_se_sgm_bdv_x1                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_x2                       = %d \n",uv_se_sgm_bdv_x2                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_x3                       = %d \n",uv_se_sgm_bdv_x3                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_y0                       = %d \n",uv_se_sgm_bdv_y0                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_y1                       = %d \n",uv_se_sgm_bdv_y1                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_y2                       = %d \n",uv_se_sgm_bdv_y2                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_s1                       = %d \n",uv_se_sgm_bdv_s1                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_s2                       = %d \n",uv_se_sgm_bdv_s2                  );
		IMP_LOG_DBG(TAG,"uv_se_sgm_bdv_s3                       = %d \n",uv_se_sgm_bdv_s3                  );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_1                        = %d \n",uv_se_bdv_adj_1                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_2                        = %d \n",uv_se_bdv_adj_2                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_3                        = %d \n",uv_se_bdv_adj_3                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_4                        = %d \n",uv_se_bdv_adj_4                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_5                        = %d \n",uv_se_bdv_adj_5                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_6                        = %d \n",uv_se_bdv_adj_6                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_7                        = %d \n",uv_se_bdv_adj_7                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_8                        = %d \n",uv_se_bdv_adj_8                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_9                        = %d \n",uv_se_bdv_adj_9                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_a                        = %d \n",uv_se_bdv_adj_a                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_b                        = %d \n",uv_se_bdv_adj_b                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_c                        = %d \n",uv_se_bdv_adj_c                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_d                        = %d \n",uv_se_bdv_adj_d                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_e                        = %d \n",uv_se_bdv_adj_e                   );
		//IMP_LOG_DBG(TAG,"uv_se_bdv_adj_f                        = %d \n",uv_se_bdv_adj_f                   );
		IMP_LOG_DBG(TAG,"uv_fusion_mv_judge_thres               = %d \n",uv_fusion_mv_judge_thres          );
		IMP_LOG_DBG(TAG,"uv_fusion_s_blur_wei                   = %d \n",uv_fusion_s_blur_wei              );
		IMP_LOG_DBG(TAG,"uv_fusion_m_blur_wei                   = %d \n",uv_fusion_m_blur_wei              );
		//IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_edge_x0                = %d \n",uv_fusion_s_sgm_edge_x0           );
		//IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_edge_x1                = %d \n",uv_fusion_s_sgm_edge_x1           );
		//IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_edge_x2                = %d \n",uv_fusion_s_sgm_edge_x2           );
		//IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_edge_y0                = %d \n",uv_fusion_s_sgm_edge_y0           );
		//IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_edge_y1                = %d \n",uv_fusion_s_sgm_edge_y1           );
		//IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_edge_s1                = %d \n",uv_fusion_s_sgm_edge_s1           );
		//IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_edge_s2                = %d \n",uv_fusion_s_sgm_edge_s2           );
		IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_pfr_x0                 = %d \n",uv_fusion_s_sgm_pfr_x0            );
		IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_pfr_x1                 = %d \n",uv_fusion_s_sgm_pfr_x1            );
		IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_pfr_x2                 = %d \n",uv_fusion_s_sgm_pfr_x2            );
		IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_pfr_y0                 = %d \n",uv_fusion_s_sgm_pfr_y0            );
		IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_pfr_y1                 = %d \n",uv_fusion_s_sgm_pfr_y1            );
		IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_pfr_s1                 = %d \n",uv_fusion_s_sgm_pfr_s1            );
		IMP_LOG_DBG(TAG,"uv_fusion_s_sgm_pfr_s2                 = %d \n",uv_fusion_s_sgm_pfr_s2            );
		IMP_LOG_DBG(TAG,"uv_fusion_s_org_br_supres_thres        = %d \n",uv_fusion_s_org_br_supres_thres   );
		IMP_LOG_DBG(TAG,"uv_fusion_s_org_br_supres_slope        = %d \n",uv_fusion_s_org_br_supres_slope   );
		IMP_LOG_DBG(TAG,"uv_fusion_s_org_dk_supres_thres        = %d \n",uv_fusion_s_org_dk_supres_thres   );
		IMP_LOG_DBG(TAG,"uv_fusion_s_org_dk_supres_slope        = %d \n",uv_fusion_s_org_dk_supres_slope   );
		//IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_edge_x0                = %d \n",uv_fusion_m_sgm_edge_x0           );
		//IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_edge_x1                = %d \n",uv_fusion_m_sgm_edge_x1           );
		//IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_edge_x2                = %d \n",uv_fusion_m_sgm_edge_x2           );
		//IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_edge_y0                = %d \n",uv_fusion_m_sgm_edge_y0           );
		//IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_edge_y1                = %d \n",uv_fusion_m_sgm_edge_y1           );
		//IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_edge_s1                = %d \n",uv_fusion_m_sgm_edge_s1           );
		//IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_edge_s2                = %d \n",uv_fusion_m_sgm_edge_s2           );
		IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_pfr_x0                 = %d \n",uv_fusion_m_sgm_pfr_x0            );
		IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_pfr_x1                 = %d \n",uv_fusion_m_sgm_pfr_x1            );
		IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_pfr_x2                 = %d \n",uv_fusion_m_sgm_pfr_x2            );
		IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_pfr_y0                 = %d \n",uv_fusion_m_sgm_pfr_y0            );
		IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_pfr_y1                 = %d \n",uv_fusion_m_sgm_pfr_y1            );
		IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_pfr_s1                 = %d \n",uv_fusion_m_sgm_pfr_s1            );
		IMP_LOG_DBG(TAG,"uv_fusion_m_sgm_pfr_s2                 = %d \n",uv_fusion_m_sgm_pfr_s2            );
		IMP_LOG_DBG(TAG,"uv_fusion_m_org_br_supres_thres        = %d \n",uv_fusion_m_org_br_supres_thres   );
		IMP_LOG_DBG(TAG,"uv_fusion_m_org_br_supres_slope        = %d \n",uv_fusion_m_org_br_supres_slope   );
		IMP_LOG_DBG(TAG,"uv_fusion_m_org_dk_supres_thres        = %d \n",uv_fusion_m_org_dk_supres_thres   );
		IMP_LOG_DBG(TAG,"uv_fusion_m_org_dk_supres_slope        = %d \n",uv_fusion_m_org_dk_supres_slope   );
		//IMP_LOG_DBG(TAG,"uv_psn_max_num                         = %d \n",uv_psn_max_num                    );
		//IMP_LOG_DBG(TAG,"uv_psn_incr_type                       = %d \n",uv_psn_incr_type                  );
		//IMP_LOG_DBG(TAG,"uv_psn_share_sta_adj                   = %d \n",uv_psn_share_sta_adj              );
		//IMP_LOG_DBG(TAG,"uv_psn_wei_step                        = %d \n",uv_psn_wei_step                   );
		IMP_LOG_DBG(TAG,"uv_psn_wei_limit                       = %d \n",uv_psn_wei_limit                  );
		//IMP_LOG_DBG(TAG,"uv_psn_max_num_wei                     = %d \n",uv_psn_max_num_wei                );
		//IMP_LOG_DBG(TAG,"uv_psn_start_wei                       = %d \n",uv_psn_start_wei                  );
		IMP_LOG_DBG(TAG,"uv_sta_blk_size_w                      = %d \n",uv_sta_blk_size_w                 );
		IMP_LOG_DBG(TAG,"uv_sta_blk_size_h                      = %d \n",uv_sta_blk_size_h                 );
		IMP_LOG_DBG(TAG,"uv_sta_blur_wei_opt                    = %d \n",uv_sta_blur_wei_opt               );
		//IMP_LOG_DBG(TAG,"uv_sta_mv_blk_bdv_x0_adj               = %d \n",uv_sta_mv_blk_bdv_x0_adj          );
		//IMP_LOG_DBG(TAG,"uv_sta_mv_blk_pdt_adj                  = %d \n",uv_sta_mv_blk_pdt_adj             );
		IMP_LOG_DBG(TAG,"uv_sta_diff_thres_val                  = %d \n",uv_sta_diff_thres_val             );
		//IMP_LOG_DBG(TAG,"uv_sta_diff_thres_val_glb              = %d \n",uv_sta_diff_thres_val_glb         );
		IMP_LOG_DBG(TAG,"uv_sta_mv_num_thres                    = %d \n",uv_sta_mv_num_thres               );
		IMP_LOG_DBG(TAG,"uv_false_color_style                   = %d \n",uv_false_color_style              );
		IMP_LOG_DBG(TAG,"uv_false_color_slope                   = %d \n",uv_false_color_slope              );
		IMP_LOG_DBG(TAG,"uv_false_color_base                    = %d \n",uv_false_color_base               );
		IMP_LOG_DBG(TAG,"uv_false_color_thres                   = %d \n",uv_false_color_thres              );
	}


	//===================================================
	// Bottom level
	//===================================================
	int32_t addr;
	int32_t data;
	//- Y FS parameter configure
	addr = NCU_Y_FS_AVE_PAR;
	data = y_fs_ave_win_opt & 0x3;
	write_reg(addr,data);

	addr = NCU_Y_FS_SIGMA_CORR_AD_X_PAR   ;
	data = ((y_fs_sgm_corr_ad_x3 & 0xff ) << 24 ) |
		((y_fs_sgm_corr_ad_x2 & 0xff ) << 16 ) |
		((y_fs_sgm_corr_ad_x1 & 0xff ) <<  8 ) |
		(y_fs_sgm_corr_ad_x0 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_SIGMA_CORR_AD_Y_PAR   ;
	data = ((y_fs_sgm_corr_ad_y2 & 0x1f ) << 16 ) |
		((y_fs_sgm_corr_ad_y1 & 0x1f ) <<  8 ) |
		(y_fs_sgm_corr_ad_y0 & 0x1f )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_SIGMA_CORR_AD_S_PAR   ;
	data = ((y_fs_sgm_corr_ad_s3 & 0x7f ) << 24 ) |
		((y_fs_sgm_corr_ad_s2 & 0x7f ) << 16 ) |
		((y_fs_sgm_corr_ad_s1 & 0x7f ) <<  8 ) ;
	write_reg(addr,data);

	addr = NCU_Y_FS_SIGMA_PFR_AD_X_PAR    ;
	data = ((y_fs_sgm_edge_ad_x3 & 0xff ) << 24 ) |
		((y_fs_sgm_edge_ad_x2 & 0xff ) << 16 ) |
		((y_fs_sgm_edge_ad_x1 & 0xff ) <<  8 ) |
		(y_fs_sgm_edge_ad_x0 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_SIGMA_PFR_AD_Y_PAR    ;
	data = ((y_fs_sgm_edge_ad_y2 & 0xf  ) << 16 ) |
		((y_fs_sgm_edge_ad_y1 & 0xf  ) <<  8 ) |
		(y_fs_sgm_edge_ad_y0 & 0xf  )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_SIGMA_PFR_AD_S_PAR    ;
	data = ((y_fs_sgm_edge_ad_s3 & 0x1f ) << 24 ) |
		((y_fs_sgm_edge_ad_s2 & 0x1f ) << 16 ) |
		((y_fs_sgm_edge_ad_s1 & 0x1f ) <<  8 ) ;
	write_reg(addr,data);

	addr = NCU_Y_FS_PFR_DIFF_PAR0         ;
	data = ((y_fs_edge_value_thres    & 0xff ) << 24 ) |
		((y_fs_edge_huge_thres     & 0xff ) << 16 ) |
		((y_fs_edge_diff_thres_high& 0xff ) <<  8 ) |
		(y_fs_edge_diff_thres_low & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_PFR_DIFF_PAR1         ;
	data = ((y_fs_edge_scope          & 0x1 ) <<  5 ) |
		((y_fs_edge_type           & 0x1 ) <<  4 ) |
		(y_fs_edge_diff_slope     & 0x3 )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_FLUCT_HG_DIFF_PAR     ;
	data = ((y_fs_fluct_hg_dk_diff_slope & 0x3  ) << 24 ) |
		((y_fs_fluct_hg_dk_diff_thres & 0xff ) << 16 ) |
		((y_fs_fluct_hg_br_diff_slope & 0x3  ) <<  8 ) |
		(y_fs_fluct_hg_br_diff_thres & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_FLUCT_BR_DIFF_PAR     ;
	data = ((y_fs_fluct_uhg_br_diff_slope      & 0x3  ) << 16 ) |
		((y_fs_fluct_uhg_br_diff_thres_high & 0xff ) <<  8 ) |
		(y_fs_fluct_uhg_br_diff_thres_low  & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_FLUCT_DK_DIFF_PAR     ;
	data = ((y_fs_fluct_uhg_dk_diff_slope      & 0x3  ) << 16 ) |
		((y_fs_fluct_uhg_dk_diff_thres_high & 0xff ) <<  8 ) |
		(y_fs_fluct_uhg_dk_diff_thres_low  & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_FS_PXL_DIFF_THRES        ;
	data = ((y_fs_pxl_limit       & 0x1  ) << 16 ) |
		((y_fs_pxl_fluct_thres & 0xff ) <<  8 ) |
		(y_fs_pxl_diff_thres  & 0xff )         ;
	write_reg(addr,data);

	//- Y SE parameter configure
	addr = NCU_Y_SE_AVE_PAR               ;
	data = ((y_se_ref_wei_motion_opt & 0x7  ) << 16) |
		((y_se_ref_image_sel      & 0x1  ) << 10) |
		((y_se_ref_pixel_filter   & 0x1  ) << 9 ) |
		((y_se_line_diff_type     & 0x1  ) << 8 ) |
		((y_se_blur_wei_opt       & 0xf  ) << 4 ) |
		(y_se_blur_win_opt       & 0x3  )        ;
	write_reg(addr,data);

	addr = NCU_Y_SE_SIGMA_BDV_X_PAR0      ;
	data = ((y_se_sgm_bdv_x2 & 0x1ff ) << 20 ) |
		((y_se_sgm_bdv_x1 & 0x1ff ) << 10 ) |
		(y_se_sgm_bdv_x0 & 0x1ff )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_SIGMA_BDV_X_PAR1      ;
	data = ((y_se_sgm_bdv_x4 & 0x1ff ) << 10 ) |
		(y_se_sgm_bdv_x3 & 0x1ff )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_SIGMA_BDV_Y_PAR0      ;
	data = ((y_se_sgm_bdv_y1 & 0x1ff ) << 16 ) |
		(y_se_sgm_bdv_y0 & 0x1ff )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_SIGMA_BDV_Y_PAR1      ;
	data = ((y_se_sgm_bdv_y3 & 0x1ff ) << 16 ) |
		(y_se_sgm_bdv_y2 & 0x1ff )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_SIGMA_BDV_S_PAR0      ;
	data = ((y_se_sgm_bdv_s2 & 0x3ff ) << 16 ) |
		(y_se_sgm_bdv_s1 & 0x3ff )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_SIGMA_BDV_S_PAR1      ;
	data = ((y_se_sgm_bdv_s4 & 0x3ff ) << 16 ) |
		(y_se_sgm_bdv_s3 & 0x3ff )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_BDV_ADJ_PAR0          ;
	data = ((y_se_bdv_adj_4  & 0x3f ) << 24 ) |
		((y_se_bdv_adj_3  & 0x3f ) << 16 ) |
		((y_se_bdv_adj_2  & 0x3f ) << 8  ) |
		(y_se_bdv_adj_1  & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_BDV_ADJ_PAR1          ;
	data = ((y_se_bdv_adj_8  & 0x3f ) << 24 ) |
		((y_se_bdv_adj_7  & 0x3f ) << 16 ) |
		((y_se_bdv_adj_6  & 0x3f ) << 8  ) |
		(y_se_bdv_adj_5  & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_BDV_ADJ_PAR2          ;
	data = ((y_se_bdv_adj_c  & 0x3f ) << 24 ) |
		((y_se_bdv_adj_b  & 0x3f ) << 16 ) |
		((y_se_bdv_adj_a  & 0x3f ) << 8  ) |
		(y_se_bdv_adj_9  & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_BDV_ADJ_PAR3          ;
	data = ((y_se_bdv_adj_f  & 0x3f ) << 16 ) |
		((y_se_bdv_adj_e  & 0x3f ) << 8  ) |
		(y_se_bdv_adj_d  & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_DIFF_THRES            ;
	data = ((y_se_line_diff_thres   & 0xff ) << 8  ) |
		(y_se_pxl_diff_thres    & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_STATIS_PAR            ;
	data = ((y_se_win5_statis_diff_thres & 0xff ) << 8  ) |
		(y_se_win5_statis_num_thres  & 0x7f )         ;
	write_reg(addr,data);

	addr = NCU_Y_SE_REF_WEI               ;
	data = (y_se_ref_wei_pseudo_still & 0x1ff);
	write_reg(addr,data);

	addr = NCU_Y_SE_CORNER_PAR            ;
	data = ((y_se_corner_sta_thres_adj & 0x3f  ) << 24 ) |
		((y_se_corner_case_bdv_adj  & 0x3f  ) << 16 ) |
		(y_se_corner_length        & 0x3ff )         ;
	write_reg(addr,data);

	//- Y Fusion parameter configure
	addr = NCU_Y_FUSION_AVE_PAR;
	data = ((y_fusion_blur_win_opt   & 0x3   ) << 29) |
		((y_fusion_mv_judge_thres & 0x1ff ) << 20) |
		((y_fusion_m_blur_wei     & 0x1ff ) << 10) |
		(y_fusion_s_blur_wei     & 0x1ff )        ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_EDGE_X_PAR0;
	data = ((y_fusion_s_sgm_edge_x1 & 0xff ) << 16 ) |
		(y_fusion_s_sgm_edge_x0 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_EDGE_X_PAR1;
	data = ((y_fusion_s_sgm_edge_x3 & 0xff ) << 16 ) |
		(y_fusion_s_sgm_edge_x2 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_EDGE_Y_PAR0;
	data = ((y_fusion_s_sgm_edge_y1 & 0x1ff) << 16 ) |
		(y_fusion_s_sgm_edge_y0 & 0x1ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_EDGE_Y_PAR1;
	data = (y_fusion_s_sgm_edge_y2 & 0x1ff);
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_EDGE_S_PAR0;
	data = ((y_fusion_s_sgm_edge_s2 & 0x3ff) << 16 ) |
		(y_fusion_s_sgm_edge_s1 & 0x3ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_EDGE_S_PAR1;
	data = (y_fusion_s_sgm_edge_s3 & 0x3ff);
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_PFR_X_PAR0;
	data = ((y_fusion_s_sgm_pfr_x1 & 0xff ) << 16 ) |
		(y_fusion_s_sgm_pfr_x0 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_PFR_X_PAR1;
	data = ((y_fusion_s_sgm_pfr_x3 & 0xff ) << 16 ) |
		(y_fusion_s_sgm_pfr_x2 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_PFR_Y_PAR0;
	data = ((y_fusion_s_sgm_pfr_y1 & 0x1ff) << 16 ) |
		(y_fusion_s_sgm_pfr_y0 & 0x1ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_PFR_Y_PAR1;
	data = (y_fusion_s_sgm_pfr_y2 & 0x1ff);
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_PFR_S_PAR0;
	data = ((y_fusion_s_sgm_pfr_s2 & 0x3ff) << 16 ) |
		(y_fusion_s_sgm_pfr_s1 & 0x3ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_SGM_PFR_S_PAR1;
	data = (y_fusion_s_sgm_pfr_s3 & 0x3ff);
	write_reg(addr,data);

	addr = NCU_Y_S_FUSION_ORG_SUP_THRES;
	data = ((y_fusion_s_org_dk_supres_slope  & 0x7  ) << 24) |
		((y_fusion_s_org_dk_supres_thres  & 0xff ) << 16) |
		((y_fusion_s_org_br_supres_slope  & 0x7  ) << 8 ) |
		(y_fusion_s_org_br_supres_thres  & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_EDGE_X_PAR0;
	data = ((y_fusion_m_sgm_edge_x1 & 0xff ) << 16 ) |
		(y_fusion_m_sgm_edge_x0 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_EDGE_X_PAR1;
	data = ((y_fusion_m_sgm_edge_x3 & 0xff ) << 16 ) |
		(y_fusion_m_sgm_edge_x2 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_EDGE_Y_PAR0;
	data = ((y_fusion_m_sgm_edge_y1 & 0x1ff) << 16 ) |
		(y_fusion_m_sgm_edge_y0 & 0x1ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_EDGE_Y_PAR1;
	data = (y_fusion_m_sgm_edge_y2 & 0x1ff);
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_EDGE_S_PAR0;
	data = ((y_fusion_m_sgm_edge_s2 & 0x3ff) << 16 ) |
		(y_fusion_m_sgm_edge_s1 & 0x3ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_EDGE_S_PAR1;
	data = (y_fusion_m_sgm_edge_s3 & 0x3ff);
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_PFR_X_PAR0;
	data = ((y_fusion_m_sgm_pfr_x1 & 0xff ) << 16 ) |
		(y_fusion_m_sgm_pfr_x0 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_PFR_X_PAR1;
	data = ((y_fusion_m_sgm_pfr_x3 & 0xff ) << 16 ) |
		(y_fusion_m_sgm_pfr_x2 & 0xff )         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_PFR_Y_PAR0;
	data = ((y_fusion_m_sgm_pfr_y1 & 0x1ff) << 16 ) |
		(y_fusion_m_sgm_pfr_y0 & 0x1ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_PFR_Y_PAR1;
	data = (y_fusion_m_sgm_pfr_y2 & 0x1ff);
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_PFR_S_PAR0;
	data = ((y_fusion_m_sgm_pfr_s2 & 0x3ff) << 16 ) |
		(y_fusion_m_sgm_pfr_s1 & 0x3ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_SGM_PFR_S_PAR1;
	data = (y_fusion_m_sgm_pfr_s3 & 0x3ff);
	write_reg(addr,data);

	addr = NCU_Y_M_FUSION_ORG_SUP_THRES;
	data = ((y_fusion_m_org_dk_supres_slope  & 0x7  ) << 24) |
		((y_fusion_m_org_dk_supres_thres  & 0xff ) << 16) |
		((y_fusion_m_org_br_supres_slope  & 0x7  ) << 8 ) |
		(y_fusion_m_org_br_supres_thres  & 0xff )        ;
	write_reg(addr,data);

	//- Y PSN parameter configure
	addr = NCU_Y_PSN_PAR_0;
	data = ((y_psn_wei_limit     & 0x1ff) << 20) |
		((y_psn_wei_step      & 0xff ) << 12) |
		((y_psn_share_sta_adj & 0x1  ) << 9 ) |
		((y_psn_incr_type     & 0x1  ) << 8 ) |
		(y_psn_max_num       & 0x1f )        ;
	write_reg(addr,data);

	addr = NCU_Y_PSN_PAR_1;
	data = ((y_psn_start_wei   & 0x1ff ) << 16) |
		(y_psn_max_num_wei & 0x1ff )        ;
	write_reg(addr,data);

	//- Y STA parameter configure
	height = ncu_image_size_height;
	width  = ncu_image_size_width ;

	int y_sta_blk_size_w_part0 = (int)(y_sta_blk_size_w/16);
	int y_sta_blk_size_w_part1 = (int)(y_sta_blk_size_w%16);
	int y_sta_blk_size_h_part0 = (int)(y_sta_blk_size_h/16);
	int y_sta_blk_size_h_part1 = (int)(y_sta_blk_size_h%16);
	int y_sta_blk_w_num;
	int y_sta_blk_h_num;

	if ((width%y_sta_blk_size_w)==0){
		y_sta_blk_w_num = (int)(width/y_sta_blk_size_w);
	}
	else {
		y_sta_blk_w_num = (int)(width/y_sta_blk_size_w) + 1;
	}

	if ((height%y_sta_blk_size_h)==0){
		y_sta_blk_h_num = (int)(height/y_sta_blk_size_h);
	}
	else {
		y_sta_blk_h_num = (int)(height/y_sta_blk_size_h) + 1;
	}

	addr = NCU_Y_STA_AVE_PAR;
	data = ((y_sta_blur_wei_opt & 0xf)<<4) |
		(y_sta_blur_win_opt & 0x3)     ;
	write_reg(addr,data);

	addr = NCU_Y_STA_SIZE_PAR;
	data = ((y_sta_blk_size_w_part0     & 0xff ) << 16) |
		(y_sta_blk_size_h_part0     & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_Y_STA_SIZE_NUM_PAR;
	data = ((y_sta_blk_w_num            & 0xff ) << 16) |
		(y_sta_blk_h_num            & 0x3ff)        ;
	write_reg(addr,data);

	addr = NCU_Y_STA_MV_BLK_ADJ;
	data = ((y_sta_mv_blk_pdt_adj    & 0xff ) << 16 ) |
		(y_sta_mv_blk_bdv_x0_adj & 0x1ff)         ;
	write_reg(addr,data);

	addr = NCU_Y_STA_DIFF_THRES;
	data = ((y_sta_diff_thres_val_glb & 0x1ff ) << 16 ) |
		(y_sta_diff_thres_val     & 0x1ff )         ;
	write_reg(addr,data);

	addr = NCU_Y_STA_MV_NUM_THRES;
	data = y_sta_mv_num_thres;
	write_reg(addr,data);

	addr = NCU_Y_STA_SIZE_INCR_PAR;
	data = ((y_sta_blk_size_w_part1 & 0xf ) << 8 ) |
		(y_sta_blk_size_h_part1 & 0xf )        ;
	write_reg(addr,data);

	//- Y luma parameter configure
	int y_br_area_adj_value_new;
	int y_dk_area_adj_value_new;
	int y_br_area_adj_dir_new;
	int y_dk_area_adj_dir_new;
	if (y_dk_area_bdv_adj_value == 0) {
		y_dk_area_adj_dir_new = 0;
	}
	else {
		y_dk_area_adj_dir_new = y_dk_area_bdv_adj_dir;
	}
	if (y_br_area_bdv_adj_value == 0) {
		y_br_area_adj_dir_new = 0;
	}
	else {
		y_br_area_adj_dir_new = y_br_area_bdv_adj_dir;
	}
	if (y_dk_area_adj_dir_new == 1) {
		y_dk_area_adj_value_new = 128 - y_dk_area_bdv_adj_value;
	}
	else {
		y_dk_area_adj_value_new = y_dk_area_bdv_adj_value;
	}
	if (y_br_area_adj_dir_new == 1) {
		y_br_area_adj_value_new = 128 - y_br_area_bdv_adj_value;
	}
	else {
		y_br_area_adj_value_new = y_br_area_bdv_adj_value;
	}

	addr = NCU_Y_LUM_AREA_PAR;
	data = ((y_dk_area_adj_value_new & 0xff ) << 24) |
		((y_dk_area_thres         & 0xff ) << 16) |
		((y_br_area_adj_value_new & 0xff ) << 8 ) |
		(y_br_area_thres         & 0xff )        ;
	write_reg(addr,data);

	//- Y Bilinear parameter configure
	addr = NCU_Y_ST2_SGM_P_X_PAR;
	data = ((y_bi_sgm_p_x3 & 0xff ) << 24) |
		((y_bi_sgm_p_x2 & 0xff ) << 16) |
		((y_bi_sgm_p_x1 & 0xff ) << 8 ) |
		(y_bi_sgm_p_x0 & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_Y_ST2_SGM_P_Y_PAR;
	data = ((y_bi_sgm_p_y3 & 0x1f ) << 24) |
		((y_bi_sgm_p_y2 & 0x1f ) << 16) |
		((y_bi_sgm_p_y1 & 0x1f ) << 8 ) |
		(y_bi_sgm_p_y0 & 0x1f )        ;
	write_reg(addr,data);

	addr = NCU_Y_ST2_SGM_P_S_PAR;
	data = ((y_bi_sgm_p_s3 & 0x3f ) << 24) |
		((y_bi_sgm_p_s2 & 0x3f ) << 16) |
		((y_bi_sgm_p_s1 & 0x3f ) << 8 ) |
		(y_bi_sgm_p_s0 & 0x3f )        ;
	write_reg(addr,data);

	addr = NCU_Y_ST2_GAUS_SGM_PAR;
	data = ((y_bi_sgm_g_4 & 0x3 ) << 16) |
		((y_bi_sgm_g_3 & 0x3 ) << 12) |
		((y_bi_sgm_g_2 & 0x3 ) << 8 ) |
		((y_bi_sgm_g_1 & 0x3 ) << 4 ) |
		(y_bi_sgm_g_0 & 0x3 )        ;
	write_reg(addr,data);

	//- UV FS parameter configure
	addr = NCU_UV_FS_AVE_PAR;
	data = ((uv_fs_pxl_limit       & 0x1  ) << 16) |
		((uv_fs_pxl_diff_thres  & 0xff ) << 8 ) |
		(uv_fs_pxl_fluct_thres & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_CORR_SIGMA_X;
	data = ((uv_fs_sgm_corr_ad_x2  & 0xff ) << 16) |
		((uv_fs_sgm_corr_ad_x1  & 0xff ) << 8 ) |
		(uv_fs_sgm_corr_ad_x0  & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_CORR_SIGMA_Y;
	data = ((uv_fs_sgm_corr_ad_y1  & 0x1f ) << 16) |
		(uv_fs_sgm_corr_ad_y0  & 0x1f )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_CORR_SIGMA_S;
	data = ((uv_fs_sgm_corr_ad_s2  & 0x3f ) << 16) |
		(uv_fs_sgm_corr_ad_s1  & 0x3f )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_PFR_SIGMA_X;
	data = ((uv_fs_sgm_edge_ad_x2  & 0xff ) << 16) |
		((uv_fs_sgm_edge_ad_x1  & 0xff ) << 8 ) |
		(uv_fs_sgm_edge_ad_x0  & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_PFR_SIGMA_Y;
	data = ((uv_fs_sgm_edge_ad_y1  & 0xf  ) << 16) |
		(uv_fs_sgm_edge_ad_y0  & 0xf  )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_PFR_SIGMA_S;
	data = ((uv_fs_sgm_edge_ad_s2  & 0xf  ) << 16) |
		(uv_fs_sgm_edge_ad_s1  & 0xf  )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_PFR_DIFF_PAR_0;
	data = ((uv_fs_edge_diff_slope     & 0x3  ) << 16) |
		((uv_fs_edge_diff_thres_high& 0xff ) << 8 ) |
		(uv_fs_edge_diff_thres_low & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_PFR_DIFF_PAR_1;
	data = ((uv_fs_edge_type           & 0x1  ) << 16) |
		((uv_fs_edge_value_thres    & 0xff ) << 8 ) |
		(uv_fs_edge_huge_thres     & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_HG_FLUCT_PAR;
	data = ((uv_fs_fluct_hg_dk_diff_slope & 0x3  ) << 24) |
		((uv_fs_fluct_hg_dk_diff_thres & 0xff ) << 16) |
		((uv_fs_fluct_hg_br_diff_slope & 0x3  ) << 8 ) |
		(uv_fs_fluct_hg_br_diff_thres & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_UHG_BR_FLUCT_PAR;
	data = ((uv_fs_fluct_uhg_br_diff_slope     & 0x3  ) << 16) |
		((uv_fs_fluct_uhg_br_diff_thres_high& 0xff ) << 8 ) |
		(uv_fs_fluct_uhg_br_diff_thres_low & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FS_UHG_DK_FLUCT_PAR;
	data = ((uv_fs_fluct_uhg_dk_diff_slope     & 0x3  ) << 16) |
		((uv_fs_fluct_uhg_dk_diff_thres_high& 0xff ) << 8 ) |
		(uv_fs_fluct_uhg_dk_diff_thres_low & 0xff )        ;
	write_reg(addr,data);

	//- UV SE parameter configure
	addr = NCU_UV_SE_CON_PAR;
	data = ((uv_se_ref_wei_motion_opt   & 0x7  ) << 28) |
		((uv_se_ref_wei_pseudo_still & 0x1ff) << 16) |
		((uv_se_blur_wei_opt         & 0xf  ) << 4 ) |
		((uv_se_line_diff_type       & 0x1  ) << 1 ) |
		(uv_se_ref_pixel_filter     & 0x1  )        ;
	write_reg(addr,data);

	addr = NCU_UV_SE_PIX_LINE_THRES;
	data = ((uv_se_line_diff_thres & 0xff ) << 16) |
		(uv_se_pxl_diff_thres  & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_SIGMA_X_0;
	data = ((uv_se_sgm_bdv_x1 & 0x1ff ) << 16) |
		(uv_se_sgm_bdv_x0 & 0x1ff )        ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_SIGMA_X_1;
	data = ((uv_se_sgm_bdv_x3 & 0x1ff ) << 16) |
		(uv_se_sgm_bdv_x2 & 0x1ff )        ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_SIGMA_Y_0;
	data = ((uv_se_sgm_bdv_y1 & 0x1ff ) << 16) |
		(uv_se_sgm_bdv_y0 & 0x1ff )        ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_SIGMA_Y_1;
	data = (uv_se_sgm_bdv_y2 & 0x1ff );
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_SIGMA_S_0;
	data = ((uv_se_sgm_bdv_s2 & 0x1ff ) << 16) |
		(uv_se_sgm_bdv_s1 & 0x1ff )        ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_SIGMA_S_1;
	data = (uv_se_sgm_bdv_s3 & 0x1ff );
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_ADJ_0;
	data = ((uv_se_bdv_adj_4  & 0x3f ) << 24 ) |
		((uv_se_bdv_adj_3  & 0x3f ) << 16 ) |
		((uv_se_bdv_adj_2  & 0x3f ) << 8  ) |
		(uv_se_bdv_adj_1  & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_ADJ_1;
	data = ((uv_se_bdv_adj_8  & 0x3f ) << 24 ) |
		((uv_se_bdv_adj_7  & 0x3f ) << 16 ) |
		((uv_se_bdv_adj_6  & 0x3f ) << 8  ) |
		(uv_se_bdv_adj_5  & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_ADJ_2;
	data = ((uv_se_bdv_adj_c & 0x3f ) << 24 ) |
		((uv_se_bdv_adj_b & 0x3f ) << 16 ) |
		((uv_se_bdv_adj_a & 0x3f ) << 8  ) |
		(uv_se_bdv_adj_9 & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_UV_SE_BDV_ADJ_3;
	data = ((uv_se_bdv_adj_f & 0x3f ) << 16 ) |
		((uv_se_bdv_adj_e & 0x3f ) << 8  ) |
		(uv_se_bdv_adj_d & 0x3f )         ;
	write_reg(addr,data);

	addr = NCU_UV_SE_CORNER_PAR;
	data = ((uv_se_corner_sta_thres_adj  & 0x3f ) << 24) |
		((uv_se_corner_case_bdv_adj   & 0x3f ) << 16) |
		(uv_se_corner_length         & 0x3ff)        ;
	write_reg(addr,data);

	//- UV FUSION parameter configure
	addr = NCU_UV_FUSION_MV_JUDGE_THRES;
	data = (uv_fusion_mv_judge_thres & 0x1ff );
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_EDGE_SIGMA_X;
	data = ((uv_fusion_s_sgm_edge_x2 & 0xff ) << 16) |
		((uv_fusion_s_sgm_edge_x1 & 0xff ) << 8 ) |
		(uv_fusion_s_sgm_edge_x0 & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_EDGE_SIGMA_Y;
	data = ((uv_fusion_s_sgm_edge_y1 & 0x1ff) << 16) |
		(uv_fusion_s_sgm_edge_y0 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_EDGE_SIGMA_S;
	data = ((uv_fusion_s_sgm_edge_s2 & 0x1ff) << 16) |
		(uv_fusion_s_sgm_edge_s1 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_PFR_SIGMA_X;
	data = ((uv_fusion_s_sgm_pfr_x2 & 0xff ) << 16) |
		((uv_fusion_s_sgm_pfr_x1 & 0xff ) << 8 ) |
		(uv_fusion_s_sgm_pfr_x0 & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_PFR_SIGMA_Y;
	data = ((uv_fusion_s_sgm_pfr_y1 & 0x1ff) << 16) |
		(uv_fusion_s_sgm_pfr_y0 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_PFR_SIGMA_S;
	data = ((uv_fusion_s_sgm_pfr_s2 & 0x1ff) << 16) |
		(uv_fusion_s_sgm_pfr_s1 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_BLUR_PAR;
	data = (uv_fusion_s_blur_wei & 0x1ff );
	write_reg(addr,data);

	addr = NCU_UV_FUSION_S_LUM_PAR;
	data = ((uv_fusion_s_org_dk_supres_slope & 0x7  ) << 24) |
		((uv_fusion_s_org_dk_supres_thres & 0xff ) << 16) |
		((uv_fusion_s_org_br_supres_slope & 0x7  ) << 8 ) |
		(uv_fusion_s_org_br_supres_thres & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_EDGE_SIGMA_X;
	data = ((uv_fusion_m_sgm_edge_x2 & 0xff ) << 16) |
		((uv_fusion_m_sgm_edge_x1 & 0xff ) << 8 ) |
		(uv_fusion_m_sgm_edge_x0 & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_EDGE_SIGMA_Y;
	data = ((uv_fusion_m_sgm_edge_y1 & 0x1ff) << 16) |
		(uv_fusion_m_sgm_edge_y0 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_EDGE_SIGMA_S;
	data = ((uv_fusion_m_sgm_edge_s2 & 0x1ff) << 16) |
		(uv_fusion_m_sgm_edge_s1 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_PFR_SIGMA_X;
	data = ((uv_fusion_m_sgm_pfr_x2 & 0xff ) << 16) |
		((uv_fusion_m_sgm_pfr_x1 & 0xff ) << 8 ) |
		(uv_fusion_m_sgm_pfr_x0 & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_PFR_SIGMA_Y;
	data = ((uv_fusion_m_sgm_pfr_y1 & 0x1ff) << 16) |
		(uv_fusion_m_sgm_pfr_y0 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_PFR_SIGMA_S;
	data = ((uv_fusion_m_sgm_pfr_s2 & 0x1ff) << 16) |
		(uv_fusion_m_sgm_pfr_s1 & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_BLUR_PAR;
	data = (uv_fusion_m_blur_wei & 0x1ff );
	write_reg(addr,data);

	addr = NCU_UV_FUSION_M_LUM_PAR;
	data = ((uv_fusion_m_org_dk_supres_slope & 0x7  ) << 24) |
		((uv_fusion_m_org_dk_supres_thres & 0xff ) << 16) |
		((uv_fusion_m_org_br_supres_slope & 0x7  ) << 8 ) |
		(uv_fusion_m_org_br_supres_thres & 0xff )        ;
	write_reg(addr,data);

	//- UV PSN parameter configure
	addr = NCU_UV_PSN_PAR_0;
	data = ((uv_psn_wei_limit     & 0x1ff) << 20) |
		((uv_psn_wei_step      & 0xff ) << 12) |
		((uv_psn_max_num       & 0x1f ) << 4 ) |
		((uv_psn_share_sta_adj & 0x1  ) << 1 ) |
		(uv_psn_incr_type     & 0x1  )        ;
	write_reg(addr,data);

	addr = NCU_UV_PSN_PAR_1;
	data = ((uv_psn_start_wei   & 0x1ff ) << 16) |
		(uv_psn_max_num_wei & 0x1ff )        ;
	write_reg(addr,data);

	//- UV STA parameter configure
	height = ncu_image_size_height/2;
	width  = ncu_image_size_width/2;
	int uv_sta_blk_size_w_part0 = (int)(uv_sta_blk_size_w/16);
	int uv_sta_blk_size_w_part1 = (int)(uv_sta_blk_size_w%16);
	int uv_sta_blk_size_h_part0 = (int)(uv_sta_blk_size_h/16);
	int uv_sta_blk_size_h_part1 = (int)(uv_sta_blk_size_h%16);
	int uv_sta_blk_w_num;
	int uv_sta_blk_h_num;
	if ((width%uv_sta_blk_size_w)==0){
		uv_sta_blk_w_num = (int)(width/uv_sta_blk_size_w);
	}
	else {
		uv_sta_blk_w_num = (int)(width/uv_sta_blk_size_w) + 1;
	}

	if ((height%uv_sta_blk_size_h)==0){
		uv_sta_blk_h_num = (int)(height/uv_sta_blk_size_h);
	}
	else {
		uv_sta_blk_h_num = (int)(height/uv_sta_blk_size_h) + 1;
	}

	addr = NCU_UV_STA_BLK_SIZE;
	data = ((uv_sta_blk_size_w_part0 & 0xff ) << 16) |
		(uv_sta_blk_size_h_part0 & 0xff )        ;
	write_reg(addr,data);

	addr = NCU_UV_STA_BLK_ADJ;
	data = ((uv_sta_mv_blk_pdt_adj    & 0xff ) << 16) |
		(uv_sta_mv_blk_bdv_x0_adj & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_STA_DIFF_THRES;
	data = ((uv_sta_blur_wei_opt       & 0xf  ) << 28) |
		((uv_sta_diff_thres_val_glb & 0x1ff) << 16) |
		(uv_sta_diff_thres_val     & 0x1ff)        ;
	write_reg(addr,data);

	addr = NCU_UV_STA_NUM_THRES;
	data = (uv_sta_mv_num_thres & 0x1fffff);
	write_reg(addr,data);

	addr = NCU_UV_STA_BLK_SIZE_INCR;
	data = ((uv_sta_blk_size_w_part1 & 0xf ) << 8 ) |
		(uv_sta_blk_size_h_part1 & 0xf )        ;
	write_reg(addr,data);

	addr = NCU_UV_STA_BLK_SIZE_NUM;
	data = ((uv_sta_blk_w_num & 0xff ) << 16) |
		(uv_sta_blk_h_num & 0x3ff)        ;
	write_reg(addr,data);

	//- UV FALSE parameter configure
	addr = NCU_UV_FALSE_COLOR_PAR;
	data = ((uv_false_color_style & 0x1  ) << 20) |
		((uv_false_color_slope & 0x3  ) << 16) |
		((uv_false_color_base  & 0xff ) << 8 ) |
		(uv_false_color_thres & 0xff )        ;
	write_reg(addr,data);

	//- trigger
	write_reg(0xc,0x5);

	return 0;

}

int32_t ncu_func_linear_insert(int32_t D0, int32_t D1, int32_t D2,
			       int32_t D3, int32_t D4, int32_t D5,
			       int32_t D6, int32_t D7, int32_t D8,
			       int32_t G0, int32_t G1, int32_t G2,
			       int32_t G3, int32_t G4, int32_t G5,
			       int32_t G6, int32_t G7, int32_t G8,
			       int32_t GAIN)
{
	int32_t result,tmp;
	int32_t DB,DA,GB,GA;

	if (GAIN <= G0){
		DA = D0;
		DB = D0;
		GA = G0;
		GB = G1;
	}
	else if (GAIN <= G1){
		DA = D0;
		DB = D1;
		GA = G0;
		GB = G1;
	}
	else if (GAIN <= G2){
		DA = D1;
		DB = D2;
		GA = G1;
		GB = G2;
	}
	else if (GAIN <= G3){
		DA = D2;
		DB = D3;
		GA = G2;
		GB = G3;
	}
	else if (GAIN <= G4){
		DA = D3;
		DB = D4;
		GA = G3;
		GB = G4;
	}
	else if (GAIN <= G5){
		DA = D4;
		DB = D5;
		GA = G4;
		GB = G5;
	}
	else if (GAIN <= G6){
		DA = D5;
		DB = D6;
		GA = G5;
		GB = G6;
	}
	else if (GAIN <= G7){
		DA = D6;
		DB = D7;
		GA = G6;
		GB = G7;
	}
	else if (GAIN <= G8){
		DA = D7;
		DB = D8;
		GA = G7;
		GB = G8;
	}
	else{
		DA = D8;
		DB = D8;
		GA = G7;
		GB = G8;
	}

	if (DA>DB) {
		tmp=DB;
		DB=DA;
		DA=tmp;
	}

	result = ((DB-DA)*1.0/(GB-GA))*(GAIN-GA) + DA;

	return result;
}

int32_t ncu_func_non_linear_insert(int32_t D0, int32_t D1, int32_t D2,
				   int32_t D3, int32_t D4, int32_t D5,
				   int32_t D6, int32_t D7, int32_t D8,
				   int32_t G0, int32_t G1, int32_t G2,
				   int32_t G3, int32_t G4, int32_t G5,
				   int32_t G6, int32_t G7, int32_t G8,
				   int32_t GAIN)
{
	int32_t result;

	if (GAIN <= G0) {
		result = D0;
	} else if (GAIN <= G1) {
		result = D1;
	} else if (GAIN <= G2) {
		result = D2;
	} else if (GAIN <= G3) {
		result = D3;
	} else if (GAIN <= G4) {
		result = D4;
	} else if (GAIN <= G5) {
		result = D5;
	} else if (GAIN <= G6) {
		result = D6;
	} else if (GAIN <= G7) {
		result = D7;
	}else if (GAIN <= G8) {
		result = D8;
	} else {
		result = D8;
	}

  	return result;
}
